daml/dev-env/bin/dade
Stefano Baghino d999a21ac3
Replace cd .. && pwd with readlink -f (#17152)
The output of `cd` might be altered by `CDPATH` set on a
system, leading to `dade` being broken because it cannot
read the current path. Instead, using `readlink -f` seem
to get the job done without side effects.
2023-07-19 12:54:33 +00:00

20 lines
536 B
Bash
Executable File

#!/usr/bin/env bash
DADE_CURRENT_SCRIPT_DIR="$( dirname $( readlink -f "${BASH_SOURCE[0]}" ) )"
source "$DADE_CURRENT_SCRIPT_DIR/../lib/dade-common"
DADE_CURRENT_SCRIPT_DIR="$( dirname $( readlink -f "${BASH_SOURCE[0]}" ) )"
if [ $# -lt 1 ]; then
"$DADE_CURRENT_SCRIPT_DIR"/dade-help
else
cmd="$1"
exe="${DADE_CURRENT_SCRIPT_DIR}/dade-${cmd}"
if [ -x "$exe" ]; then
shift
DADE_CURRENT_COMMAND="dade-${cmd}" exec "$exe" "$@"
else
echo "Unrecognized command ${cmd}, executable ${exe}."
exit 1
fi
fi