Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hmmm... I think this is a bug...?

0 views
Skip to first unread message

Chet Ramey

unread,
Jan 18, 1994, 11:43:51 PM1/18/94
to
> I'm not sure whether I'm using bash correctly, but I think my version has a
> bug in global substitution.

It's actually a misunderstanding. The `global' substitution enabled
with the `g' modifier means to change the first occurrence of (in
your example) `s' into `z' in all words in the previous command
instead of the first. There's no way to do what you want with the
csh-style history substitution.

Chet

--
"You can watch an actor absolutely sabotage a good script and then read
reviews like 'Unfortunately, even the impressive talents of Cheech Marin
could not salvage Anton Chekhov's trite and meandering script.'"
Chet Ramey, Case Western Reserve University Internet: ch...@po.CWRU.Edu

Chris Parkin Lilley

unread,
Jan 18, 1994, 11:44:28 PM1/18/94
to
Hi there!

I'm not sure whether I'm using bash correctly, but I think my version has a
bug in global substitution.

GNU bash, version 1.13.4-CWRU
Sun SparcStation IPX, SunOS 4.1.1
Compiled using Sun's cc

Take a simple example like 'ls /etc/passwd'

Let's say that I then decide (for no readily apparent reason) that I want to
change all the `s' characters to `z'. I imagined I would type something like

!!:gs/s/z/

but this yields

lz /etc/pazswd

When I tried
ls /etc/passwd /etc/fstab
!!:gs/s/z/
I got
lz /etc/pazswd /etc/fztab

and when I tried
ls /etc/passwd /etc/passwd
!!:gs/s/z/
I got
lz /etc/pazswd /etc/pazswd

Should it change every occurrence of `s' to `z', or only the first occurrence in
every word? Am I just using it incorrectly?

Thanks for your help in understanding this one...

-Chrisl
___________________________________________________________________________

chr...@jfbi.cv.com Chris Parkin Lilley, Un petit d'un petit
Phone: (+44) 203 874368 ProFET Development Team S'etonne aux Halles
Fax: (+44) 203 874761 Rover Group, UK Un petit d'un petit
A degres te falles
___________________________________________________________________________


0 new messages