Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to check input arguments Bash Shell Script on Mac

I want to check input arguments presence on a bash script on OSX. I do:

if [-z "$1"]

I get:

/usr/local/bin/deploy.sh: line 8: [-z: command not found

Any tips?

Thanks.

like image 391
More Than Five Avatar asked Jun 16 '26 19:06

More Than Five


1 Answers

You need a space around the condition:

if [ -z "$1" ]

    ^       ^
like image 88
P.P Avatar answered Jun 19 '26 10:06

P.P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!