Last active
March 19, 2020 13:51
-
-
Save jaychsu/e647615cc1649c0d1281b99cdc4dbd84 to your computer and use it in GitHub Desktop.
Pass parameters in zsh
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
# https://stackoverflow.com/questions/42655304/how-do-i-check-if-a-variable-is-set-in-zsh | |
test() { | |
test2 $@ | |
test3 $@ | |
} | |
test2() { | |
if [[ $# -eq 0 ]]; then | |
echo 'no params' | |
else | |
echo $@ | |
fi | |
} | |
test3() { | |
if [[ -n $1 ]]; then | |
echo $1 | |
else | |
echo 'no params' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment