Can anyone tell me what the -a in Unix shell validation conditions means?

Can anyone tell me what it means -a

in unix. See the following code:

if [ "$x"  = "$x" -a "y" -eq 0 ]  ; then
echo $x
else 
echo $y 

      

+2


a source to share


2 answers


it means "and". -o "or".

From man bash



expr1 -a expr2
                     True if both expr1 and expr2 are true.

      

+9


a source


Quote 4.1 Bourne's built-in shells (i.e. manual, online, with anchors):



test


[


  Evaluate conditional expression expr. Each operator and operand must be a separate argument.
  Expressions are composed of primaries, described below in the section Bash Conditional Expressions.
  test

neither accepts any options nor does it accept and ignore an argument - as signifying the end of options.
...
expr1 -a expr2


  True if both expr1 and expr2 are true.

+3


a source







All Articles