1
validate() {

        if [ -z "$1" ]
        then
                echo "$1 variable does not set !"
                exit 1
        else
                echo "$1 variable is set !"
        fi

}

the problem is that when the varibal not set the $1 dosn't evaluate to any thing and im getting empty string how can i get the argument name string so i can pressent it

i call the function like this :

validate "$FOO"
Edit
My question is how to get in the function the argument name not value So it give me the "$FOO" string Im not asking how to validate the value
SO if $FOO does not set it will print me
$FOO variable does not set !

user63898
  • 29,839
  • 85
  • 272
  • 514

0 Answers0