Thanks to both you and Glenn for your elucidation. On 01/25/2008 12:37, David Korn wrote: > Subject: Re: [ast-users] Re: [bbx-list] Re: old SCO script not working in > Suse Linux > -------- > > > 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? > > Since > [ "$aa" <> "XX" ] > is an ordinary command, unlike [[...]], it is parsed with the normal rules. > Redirection operators can be anywhere on the line so that this is equivalent > to > [ "$aa" ] <> "XX" > The <> opens XX for reading and writing. > > This returns true if $aa is not empty and if $aa does not begin with - > and is not ! in which case it could be an error. > > David Korn > [EMAIL PROTECTED] > _______________________________________________ > ast-users mailing list > [email protected] > https://mailman.research.att.com/mailman/listinfo/ast-users >
-- Roger Cornelius [EMAIL PROTECTED] _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
