History substitution
Chris Torek
chris at mimsy.umd.edu
Wed Mar 7 20:26:16 AEST 1990
In article <22613 at adm.BRL.MIL> MMKOISTINEN at uku.fi
(MIKA KOISTINEN (PHONE 971-311796)) writes:
> echo aa ab aaaa
> !:gs/a/b
> echo ba bb baaa
>What's wrong ?
The C shell documentation says:
s/l/r/ Substitute l for r
and
g Apply the change globally, prefixing the above, e.g. `g&'.
What it does not say is that `g' means `apply the change to every *word*',
rather than `to every instance of ``l'' in every word'. The C shell will
only substitute once in each argv[] element. (It quietly implies this with
the sentence:
Unless preceded by a `g' the modification is applied only to
the first modifiable word. With substitutions, it is an
error for no word to be applicable.
In other words, everything is based on words, not on characters.)
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list