(( )) is purely for arithmetic expressions.
I think the simplest, most readable valid "upgrade"
to your original expression is

        if (( $# > 1 )) && [[ -t 0 && -t 1 ]]; then

Anyway, that's how I would do it. :-)


-Mario D
  Lifelong disciple of the KISS programming principle
  and avid ksh fan since 1983.


On 5/11/2010 8:32 PM, Andrew Clarke wrote:
Folks,

I'm way overdue for changing my habit of using [[ ]] and replacing it
with use of (( )) where appropriate. But as I'm trying to rewrite

        if [[ $# -gt 1 ]]&&  [[ -t 0&&  -t 1 ]]; then

into something like

        if (($#>  1&&  -t 0&&  -t 1)); then

I see that operators like -n, -z, -t, -r, -x, etc are not accepted. Am I
missing something? Can [[  ]] or $(( )) or anything similar be nested
inside these expressions?


_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to