ksh - Unix - condition within condition -
i've been looking on place couldn't find answer. in ksh, how do this:
while [ [ ! [ [ -n $var1 ] || [ [ -n $var2 ] && [ -n $var3 ] ] ] ] && [ ! [ [ -n $var1 ] && [ -n $var2 ] ] ] ]; ...etc etc done
or in pseudo/a bit easier way see
while ((! ((var1 != none) or ((var2 != none) , (var3 != none))) , (!((var1 != none) , (var2 != none)))) { .... }
...essentially kind of conditions grouped
i've found lot on simple conditions if [ -z $var1 ] && [ -n $var2 ]; then
but not 1 above.
any appreciated.
it's easier use ksh
's [[ ]]
syntax. (
, )
don't need quoted , can use &&
, ||
in c language. example:
[[ ! ( -n $var1 && ( -n $var2 || -n $var3 ) ) ]]
also, don't need double quote $var
within [[ ]]
make code cleaner.
Comments
Post a Comment