Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 47 lines (37 sloc) 1.14 KB
#!/bin/bash
# this script is intended to work both in narwhal/bin and in
# any project's bin dir; it's copied by tusk --init.
function enquote_all () {
ARGS=""
for ARG in "$@"; do
[ -n "$ARGS" ] && ARGS="$ARGS "
ARGS="$ARGS'""$(echo " $ARG" | cut -c 2- | sed 's/'"'"'/'"'"'"'"'"'"'"'"'/g')""'"
done
echo "$ARGS"
}
# get the absolute path of the executable
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
# resolve symlinks
while [ -h "$SELF_PATH" ]; do
DIR=$(dirname -- "$SELF_PATH")
SYM=$(readlink -- "$SELF_PATH")
SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done
export PACKAGE_HOME=$(dirname -- "$(dirname -- "$SELF_PATH")")
source "$PACKAGE_HOME/bin/activate.bash"
export OLDSEA="$SEA"
export SEA="$PACKAGE_HOME"
export SEALVL="$((SEALVL + 1))"
if [ "$#" -lt 1 ]; then
echo PATH="$PATH" >&2
echo SEA="$SEA" >&2
echo SEALVL="$SEALVL" >&2
# __SHELL_CUSTOMIZATIONS__
"$SHELL"
else
"$SHELL" -c "$(enquote_all "$@")"
fi
if [ "$OLDSEA" != "" ]; then
echo SEA="$OLDSEA" >&2
fi
echo SEALVL="$((SEALVL - 1))" >&2