aboutsummaryrefslogtreecommitdiff
path: root/libbutl/utility.bash.in
blob: 56bd3ab40ddb1acf4e2e711b5a46cbf7cfd9e20f (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
# file      : libbutl/utility.bash.in
# 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]}"
}