zsh-workers
 help / color / mirror / code / Atom feed
* Re: Re: is this really correct
@ 1996-06-10 18:07 gene
  1996-06-10 18:33 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: gene @ 1996-06-10 18:07 UTC (permalink / raw)
  To: zsh-workers

[on Jun 10 Hrvoje Niksic said]
> > % a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi 
> 
> exists and has a size greater than zero :-). This works for me:
> $ echo hi > =
> $ a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi
> yeh
> 
>End included message on "Re: Is this really correct ?"


I like this, the problem is, for this to be really useful we need:

  if [ "$a" = "-s" ] ; then echo "hi" > = ; fi
  if [ "$a" = "-s" ] ; then echo "yeh" ; fi

  But the first if fails .... :-)

  Joking aside, this may be correct, but it kind of fails the "gee whiz"
  behaviour test. I suppose one would use a 'case' statement.

  What is the "preferred" way of testing strings that may be arbitrarily
  input then given the above ? I mean one does not know what 'a' is until
  you do a test on it right ?


  

Gene
gene@bear.com

--
*******************************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, offer or
agreement or any information about any transaction, customer account or account
activity contained in this communication.
*******************************************************************************



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Re: is this really correct
  1996-06-10 18:07 Re: is this really correct gene
@ 1996-06-10 18:33 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1996-06-10 18:33 UTC (permalink / raw)
  To: gene; +Cc: Zsh workers list

>   What is the "preferred" way of testing strings that may be arbitrarily
>   input then given the above ? I mean one does not know what 'a' is until
>   you do a test on it right ?

As I said I'll modify [ ... ] according to POSIX which will fix this
problem (maybe it was not clear that test and [ are the same).  But in zsh
one can use

% a="-s"; if [[ "$a" = "-s" ]] then echo "yeh" ; fi

which should work with all zsh versions.

Zoltan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-06-10 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-10 18:07 Re: is this really correct gene
1996-06-10 18:33 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).