Marc a écrit :
> source $(dirname "$0")/functions.sh
I usually begin all my scripts with this beast:
absolutiseScripts() { SCRIPTS="$1" ; echo "$SCRIPTS" | grep -q ^/ ||
SCRIPTS="`dirname "$2"`/$SCRIPTS" ; } ; absolutiseScripts "`command -v "$0"`"
"`pwd`/." ; while [ -h "$SCRIPTS" ] ; do absolutiseScripts "`readlink
"$SCRIPTS"`" "$SCRIPTS" ; done ; SCRIPTS="`dirname "$SCRIPTS"`"
I use it with bash on Mac OS X, FreeBSD, Linux, and it seems (just tested now
at work) that HP/UX 11 with its bare sh can handle it.
It does a lot of symlink-resolution, because I typically store my scripts in an
src/scripts directory, with symlinks from $HOME/bin/tagadatsointsoin to
$HOME/src/scripts/tagadatsointsoin.
--
Guillaume