Skip to content

Instantly share code, notes, and snippets.

@adamruzicka
Created May 30, 2018 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamruzicka/e15307a67309dd46250adc4c3fbe5cea to your computer and use it in GitHub Desktop.
Save adamruzicka/e15307a67309dd46250adc4c3fbe5cea to your computer and use it in GitHub Desktop.
#!/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