aboutsummaryrefslogtreecommitdiff
path: root/libbutl/utility.bash.in
blob: 3eab109a0dbd06256d25d167f0fd4df1533f2c0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# file      : libbutl/utility.bash.in
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

if [ "$butl_utility" ]; then
  return 0
else
  butl_utility=true
fi

if (( BASH_VERSINFO[0] < 4 || BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 3 )); then
  echo 'error: bash 4.3 or later is required' 2>&1
  exit 1
fi

# Return the libbutl/ module directory.
#
# This is used to run the binding support executables.
#
function butl_path ()
{
  # BASH_SOURCE[0] contains the source path of the function being executed
  # (that is, us).
  #
  dirname "${BASH_SOURCE[0]}"
}