mardi 5 janvier 2021

Bash command not found/ [: mising `]' bash error

Bash command not found and [: mising `]' error in bash script

I've a Bash Script as follows:

if [ "$1" == ""] then echo "Something"

But when I run the script with arguments, I get the error given below first and then next script gets executed properly

[: mising `]'

I also tried this:

if ["$1" == ""] then echo "Something" (Note that I removed the space before "$1")

For above code I get [<given argument>==]: command not found and then the remaining script executes

So can anyone tell me why I get the error messages like this??

Aucun commentaire:

Enregistrer un commentaire