<> is an io redirection operator
[ is a simple command, not a shell special builtin
so
[ "$aa" <> "XX" ]
is (must be) parsed the same as
cat "$aa" <> "XX"
in ksh93 this would be done using the [[ ... ]] builtin test, which
it fully parses:
ksh -c '[[ "$aa" <> "XX" ]]'
which produces
ksh: syntax error at line 1: `<>' unexpected
On Fri, 25 Jan 2008 09:58:38 -0500 Roger Cornelius wrote:
> On another, non-ksh related, mailing list, someone wrote:
> > <> is a legal operator under SCO's old version of ksh, and also under
> > Linux's bash.
> >
> > This runs fine under 5.0.7 and ksh:
> >
> > aa="OK"
> >
> > if [ "$aa" <> "XX" ]
> > then
> > echo "Was not XX"
> > fi
> >
> > The echo line displays when run.
> This indeed works as he describes, but the case where the two items
> being tested are equal does not. I.e.:
> aa="OK"
> if [ "$aa" <> "OK" ]
> then
> echo "Was not XX"
> fi
> This still prints "Was not XX". I don't believe <> was ever valid
> syntax, so what is really going on here. Are the <> operators being
> interpreted as IO redirection? Why does the shell not generate an error?
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users