Thread: bash: if santax help: [ X ] && [ Y ] || [ Z ]
how write in sh/bash
javascript/php:
this closest can without breaking it:code:if ( 1 == 1 && ( 1==2 || 2==2 ) ) { }
code:if [ 1 -eq 1 ] && [ 1 -eq 2 ] || [ 2 -eq 2 ];then fi
edit: forget it, it's wrong. following posts explain why.. trying variations, may post corrected 1 later..
works me.code:if [[ 1 -eq 1 && 1 -eq 2 || 2 -eq 2 ]];then fi
example :
..change declared values or test values , see difference. works -code:a=2; b=3; c=4; if [[ $a -eq 2 && $b -eq 2 || $c -eq 4 ]]; echo yes; fi
if (condition 1) , (condition2 or condition3), then go ahead..
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk bash: if santax help: [ X ] && [ Y ] || [ Z ]
Ubuntu
Comments
Post a Comment