Article View: comp.unix.shell
Article #1731Re: csh question (and ksh port maybe)
From: Jonathan I. Kamens
Date: Thu, 08 Nov 1990 21:47
Date: Thu, 08 Nov 1990 21:47
42 lines
2709 bytes
2709 bytes
In article <45969@sequent.UUCP>, calvin@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@Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
Technical Details
Message-ID:
<1990Nov8.214713.4658@athena.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!olivea!mintaka!bloom-beacon!athena.mit.edu!jikReferences:
<45969@sequent.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!olivea!mintaka!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.shell Subject: Re: csh question (and ksh port maybe) Message-ID: <1990Nov8.214713.4658@athena.mit.edu> Date: 8 Nov 90 21:47:13 GMT References: <45969@sequent.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 42