haldis/parse_hlds.sh
Francis Begyn 4924f22b48 make shell scripts portable
The current shell scripts call `/bin/bash`. This won't work on certain
systems (`nixos` for example 👀).

By switching to `/usr/bin/env bash` these scripts become portable. As
long as `bash` environment is present on a system, the scripts will
work.
2022-04-19 19:17:27 +02:00

17 lines
434 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# args = map(lambda arg: arg if x[0] in "/-" else pwd+arg, sys.argv[1:])
args=()
for i in "$@"; do
# If argument is not an option and not an absolute path, it's a relative path: prepend current
# working directory
case "$i" in
/*|-*) args[${#args[@]}]="$i"; ;;
*) args[${#args[@]}]="$PWD/$i"; ;;
esac
done
cd "$(dirname "$0")/app"
exec ../venv/bin/python parse_hlds.py "${args[@]}"