csh question (and ksh port maybe)
Jonathan I. Kamens
jik at athena.mit.edu
Fri Nov 9 08:47:13 AEST 1990
In article <45969 at sequent.UUCP>, calvin at sequent.sequent.com (Calvin Goodrich) writes:
|> can any of you unix.gods tell me what :e :h :t :r :q :x :gh :gt :gr
|> stand for in csh? i've seen these used before but couldn't figure them out.
|> for the rtfm'ers in the crowd: yes, i read the man pages on csh but couldn't
|> get an informative answer.
Then you must have an emasculated version of the csh man page, because mine
documents them as follows:
After the optional word
designator can be placed a sequence of modifiers, each pre-
ceded by a `:'. The following modifiers are defined:
h Remove a trailing pathname component, leaving the head.
r Remove a trailing `.xxx' component, leaving the root name.
e Remove all but the extension `.xxx' part.
s/l/r/ Substitute l for r
t Remove all leading pathname components, leaving the tail.
& Repeat the previous substitution.
g Apply the change globally, prefixing the above, e.g. `g&'.
p Print the new command but do not execute it.
q Quote the substituted words, preventing further substitutions.
x Like q, but break into words at blanks, tabs and newlines.
If your csh man page doesn't have this, I suggest you get a new csh man page.
If it does, then what exactly about it do you not understand?
|> next question: do these things have an equivalent in ksh? apparently ksh
|> doesn't have these little buggers. if they're useful i want to be able to
|> use them in my favorite (imho, anyway) shell.
I don't use ksh, but from a quick look at the ksh man page, I don't see
anything that can do what all of the modifiers above do. Some of them can be
done by calling a subprocess such as sed or awk; others can probably be done
using clever quoting, and still others can probably be done with ksh commands
that I'd know about if I used ksh regularly :-).
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.shell
mailing list