On Tue, 6 Aug 1996, Emilio Lopes wrote: > >>>>> "CS" == Craig Sanders <[EMAIL PROTECTED]> wrote: > > CS> I'd like to see a bourne-like shell with perl-like regexp stuff > CS> (mainly sed & grep) built in - i'd switch to that in a flash. > > People may say it's called ksh93. IMHO, it may seem somewhat > interesting, but I really don't like it. Look likes tcl... :-)
zsh seems to have some of these features. see http://www.mal.com/zsh/ for full details, but this looks useful: and a substitution modifier: % echo $name:s/foo/bar/ bar.c % ls foo.c foo.h foo.o foo.pro % for i in foo.*; mv $i $i:s/foo/bar/ % ls bar.c bar.h bar.o bar.pro it's only simple substitution, though. no regexp. (siva-cas) ~$ zsh % fred=xyz.abc.zzz % echo $fred xyz.abc.zzz lets try a regexp subsitution ala sed: % echo $fred:s/\(...\).\(...\).\(...\)/\3\2\1/ xyz.abc.zzz ok. that obviously doesn't work. lets try a different format: % echo $fred:s/(...).(...).(...)/\3\2\1/ xyz.abc.zzz nope. you can string together multiple substitions, though: % echo $fred:s/abc/111/ xyz.111.zzz % echo $fred:s/abc/111/:s/xyz/222/ 222.111.zzz % echo $fred:s/abc/111/:s/xyz/222/:s/zzz/333/ 222.111.333 zsh looks like it's got nice stuff out of sh/bash, ksh, and csh. looks useful, but it doesn't get eliminate the need to fork sed and grep. hmmm...the substitution facility could be useful for standardising responses in a case statement: read yesno case $yesno:l:s/yes/y/:s/no/n/ in y) do_yes ;; n) do_no ;; *) do_error ;; esac it's probably too non-standard to use for debian.{pre,post}{rm,inst} scripts but i might switch to it for my personal use.