]> arthur.barton.de Git - ax-unix.git/blob - lib/ax/README
581418ada2932018a6fa3c5decca4beff33a6338
[ax-unix.git] / lib / ax / README
1 ax-unix: Alex' UNIX Tools & Scripts
2 Copyright (c)2013-2017 Alexander Barton (alex@barton.de)
3
4 This directory contains library files to use in 3rd party applications and
5 scripts. Please see below for usage information.
6
7
8 ax-common.sh
9 ------------
10
11 This is a shell script library containing common useful functions. If you want
12 to use it in your own code, your script must include ("source") this library
13 file, and therefore it has to check some common locations (if you don't bundle
14 it in some other ways and exactly know the location it is installed in).
15
16 Use something like the following in your scrips:
17
18 ----> cut here <---------------------------------------------------------------
19 # Include "ax-common.sh":
20 ax_common_sourced=
21 for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do
22         [ -z "$ax_common_sourced" ] || break
23         ax_common="${dir}/lib/ax/ax-common.sh"
24         # shellcheck source=/usr/local/lib/ax/ax-common.sh
25         [ -r "$ax_common" ] && . "$ax_common"
26 done
27 if [ -z "$ax_common_sourced" ]; then
28         echo "Error ($(basename "$0")): \"ax-common.sh\" not found, aborting!"
29         echo "Please install 'ax-unix', \"Alex' UNIX Tools & Scripts\", and try again."
30         exit 99
31 fi
32 unset dir ax_common ax_common_sourced
33 ----> cut here <---------------------------------------------------------------