On 2010-05-13 01:35, Andrew Clarke:
(( list || ($#>0&& (isatty(0) || isatty(1))) ))
This is interesting. Do the functions always have to be in a .math.
namespace? Is (( )) locked into mathematical features? I see it already
supports a few dozen mathematical functions, some of which I've never
even heard of. I expect it would be a fairly easy win to add a bunch of
functions like stat() into the set which can be used by (( )).
I hesitate to suggest literal support for -X functionality but it's an
option. Perl has made it work, but I don't expect Perl is ever seen as a
shining beacon of language design...
There is a way of adding the perl operators to ksh, but we need to
combine a function with an alias:
#!/bin/sh
tty_onall() for fd; do [[ -t $fd ]] || return 1; done
alias -- -t=tty_onall
(set -x && -t 0 1) && echo ok || echo no
-t 0 1 5 && echo ok || echo no
The original test would be equivalent to:
-t 0 1 && [[ -n $2 ]] || ((list))
Cheers,
Henk
(resent to match my subscription address on ast-users)
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users