[clug] sh scripts and =~ in csh

Andrew Janke a.janke at gmail.com
Wed Sep 12 04:10:56 GMT 2007


On 9/12/07, Jeremy Kerr <jk at ozlabs.org> wrote:
>
> > if [ "$answer" == "y*" ] ; then
>
> Almost! :)
>
> if [[ "$answer" == y* ]]
>
> (the single-square-bracket syntax doesn't support regex matching, and
> the quoting you have around "y*" makes it a plain-string match)

Thanks all for the help,

I initially went for Tony suggestion with something like:

   if [ "$(echo "$answer" | cut -f1 -dy ....

but decided in the end to take Kims advice with the case.

Thanks again,


a


More information about the linux mailing list