3

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.

RubioRic
  • 2,442
  • 4
  • 28
  • 35
More Than Five
  • 9,959
  • 21
  • 77
  • 127
  • check [this answer](http://stackoverflow.com/questions/6482377/bash-shell-script-check-input-argument) – Christos Papoulas Sep 08 '13 at 10:54
  • possible duplicate of ["Command not found" when attempting integer equality in bash](http://stackoverflow.com/questions/4468824/command-not-found-when-attempting-integer-equality-in-bash) – chepner Sep 08 '13 at 13:29

1 Answers1

7

You need a space around the condition:

if [ -z "$1" ]

    ^       ^
P.P
  • 117,907
  • 20
  • 175
  • 238