replace pushd/popd with shell agnostic solution

This commit is contained in:
foobar 2025-03-13 11:16:49 +00:00 committed by James Hodgkinson
parent 5fb2173d93
commit 9e32d353a4

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -e
@ -29,7 +29,9 @@ if [ ! -f "${CONFIG_FILE}" ]; then
exit 1
fi
pushd "${SCRIPT_DIR}" > /dev/null 2>&1
# Save current directory and change to script directory without pushd
OLD_DIR=$(pwd)
cd "${SCRIPT_DIR}" > /dev/null 2>&1
if [ -n "${1}" ]; then
COMMAND=$*
#shellcheck disable=SC2086
@ -40,4 +42,4 @@ else
#shellcheck disable=SC2086
cargo run ${KANI_CARGO_OPTS} --bin kanidmd -- server -c "${CONFIG_FILE}"
fi
popd > /dev/null 2>&1
cd $OLD_DIR > /dev/null 2>&1