[clug] sh scripts and =~ in csh

Kim Holburn kim.holburn at gmail.com
Tue Sep 11 08:30:51 GMT 2007


None of the other solutions are good.  Here is one that works fine in  
sh (any sh)

answer="yes"
case "$answer" in
y*)
   dostuff;;
esac

On 2007/Sep/11, at 4:32 AM, Andrew Janke wrote:

> Just "sh-ifying" and old csh script that has been lying about and
> cannot for the life of me remember the equivalent of this in sh...
>
> set answer = "yes"
> if ("$answer" =~ y*) then
>    dostuff
> endif
>
> ie: what is the equivalent of =~?
>
> ta
>
>
> -- 
> Andrew Janke   (a.janke at gmail.com || http://a.janke.googlepages.com/)
> Canberra->Australia    +61 (402) 700 883
> -- 
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux

--
Kim Holburn
IT Network & Security Consultant
Ph: +39 06 855 4294  M: +39 3494957443
mailto:kim at holburn.net  aim://kimholburn
skype://kholburn - PGP Public Key on request

Democracy imposed from without is the severest form of tyranny.
                           -- Lloyd Biggle, Jr. Analog, Apr 1961





More information about the linux mailing list