Created
May 30, 2018 10:28
-
-
Save adamruzicka/e15307a67309dd46250adc4c3fbe5cea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TESTDIR="$(mktemp -d)" | |
LIBEXEC_DIR="${TESTDIR}/hooks with spaces" | |
echo "Testing in $TESTDIR" | |
mkdir "$LIBEXEC_DIR" | |
echo 'echo good' > "${LIBEXEC_DIR}/good-before-relabel.sh" | |
chmod +x "${LIBEXEC_DIR}/good-before-relabel.sh" | |
echo 'echo also good' > "${LIBEXEC_DIR}/this should be alsoo good-before-relabel.sh" | |
chmod +x "${LIBEXEC_DIR}/this should be alsoo good-before-relabel.sh" | |
echo "vvv This doesn't work vvv" | |
for hook in "${LIBEXEC_DIR}/*-before-relabel.sh"; do | |
echo "checking hook |$hook|" | |
[[ -x $hook ]] && $hook | |
done | |
echo "^^^ This doesn't work ^^^" | |
echo | |
echo "vvv This works vvv" | |
for hook in "${LIBEXEC_DIR}"/*-before-relabel.sh; do | |
echo "checking hook |$hook|" | |
[[ -x "$hook" ]] && "$hook" | |
done | |
echo "^^^ This works ^^^" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment