3 ms·
I'm often deep in some subdirectory structure when I want to call "make". This script (intended to be put in .zshrc or .bashrc) makes my life much easier. f
by hnfong 3y ago
I'm often deep in some subdirectory structure when I want to call "make". This script (intended to be put in .zshrc or .bashrc) makes my life much easier.
function mk {
local PWDBEFOREMK="`pwd`"
local MK__RET=1
while [[ "$PWD" != "/" ]]; do
echo "Trying make in $PWD ..."
if [[ -f Makefile ]]; then
make "$@"
MK__RET="$?"
if [[ "$MK__RET" = "0" ]]; then
touch .lastmake
fi
break
fi
if [[ -f gradlew ]]; then
./gradlew "$@"
break
fi
cd ..
done
cd "$PWDBEFOREMK"
[ "$MK__RET" = "0" ];
}