I have a post-commit hook that works, but for some reason the following line of code is not working properly. It creates my test file regardless of a fail.
!#/bin/sh
# force a failure
ifconfig -z 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
touch ~/Desktop/fail.txt
fi
The fail.txt file is created with or without that -z
. However, if I run this same code without executing via my post-commit hook, it works as it should.
Any suggestions?