[clug] sh scripts and =~ in csh
Martijn van Oosterhout
kleptog at svana.org
Tue Sep 11 06:39:51 GMT 2007
On Tue, Sep 11, 2007 at 12:32:31PM +1000, 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 =~?
Is this "sh-ifying" or "bash-ifying". Because my bash manpage lists a
=~ operator, as well as stating that == and != work on patterns also.
So possibly:
if [ "$answer" == "y*" ] ; then
Hope this helps,
--
Martijn van Oosterhout <kleptog at svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/linux/attachments/20070911/28c10735/attachment.bin
More information about the linux
mailing list