]> arthur.barton.de Git - ax-unix.git/blob - lib/ax/README
Add lib/ax/ax-common.sh
[ax-unix.git] / lib / ax / README
1 ax-unix: Alex' UNIX Tools & Scripts
2 Copyright (c)2013-2015 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 for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do
21         [ -z "$ax_common_sourced" ] || break
22         ax_common="${dir}/lib/ax/ax-common.sh"
23         [ -r "$ax_common" ] && source "$ax_common"
24 done
25 if [ -z "$ax_common_sourced" ]; then
26         echo "Error (`basename "$0"`): \"ax-common.sh\" not found, aborting!"
27         echo "Please install 'ax-unix', \"Alex' UNIX Tools & Scripts\", and try again."
28         exit 99
29 fi
30 unset dir ax_common ax_common_sourced
31 ----> cut here <---------------------------------------------------------------