| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
Thanks very much (Rakesh) for pointing the C shell behavior. I rarely if ever use C shell. But many others do. I would have guessed that single quoting an exclamation in C shell would make it a literal. But the designers of C shell were pretty smart folks, they must have had their reasons.
Your observation reinforces the point that sed can be somewhat subject to the "whims" of the shell that it runs within. Anyone who has spent much time with quoting a complex command line expression has seen that.
I don't think it is a good idea to consider using the "yes" command or '\!' or '\x21' for this kind of example. So here is an alternate suggestion for the sed "Hello, world!" example for group members to consider:
------------------------------
# convert input text stream to "Hello, world!"
s/.*/Hello, world!/
q
------------------------------
sed is really two things in one: 1) the command-line utility. 2) the simple scripting language that the sed utility reads. By separating out the script from the command line environment, this example is immune (I think) to command line oddities like the C shell behavior and differences in sed versions.
So is this the best "Hello, world!" example? Or is there some other defect lurking, or some better way?
Thanks,
Daniel