hp ux - Hp-Ux.Shell.Using variables in "if" -


recently i've got confused following situation. difference between 2 if usage:

case 1

amount=10   if [[ $amount -eq 10 ]]          echo "something"   fi   

script output:

$ ./1.sh     

case 2

if [[ amount -eq 10 ]]    

this works (note variable name doesn't contain $).

so question how work without dollar sign in variable name.

p.s. i'm using posix shell on hp-ux.

man bash

arithmetic evaluation ... shell variables allowed operands; parameter expansion per‐ formed before expression evaluated. within expression, shell variables may referenced name without using parameter expansion syntax.

in context shell not expect numerics, expands strings variables. makes sense me.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -