csh question (and ksh port maybe)
karl_kleinpaste at cis.ohio-state.edu
karl_kleinpaste at cis.ohio-state.edu
Sat Nov 10 08:10:05 AEST 1990
calvin at sequent.sequent.com 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.
Um, RTFM.
A SunOS 4.1 csh(1) man page discusses exactly what these terms mean on
pages 5 and 9. Same thing for Pyramid OSx 4.4c's csh(1) man page.
>From the Pyr version:
(page 5)
The `:' separating the event specification from the word
designator can be omitted if the argument selector begins
with a `|', `$', `*' `-' or `%'. 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.
(page 9)
The modifiers `:h', `:t', `:r', `:q' and `:x' may be applied
to the substitutions above as may `:gh', `:gt' and `:gr'.
If braces `{' '}' appear in the command form then the modif-
iers must appear within the braces. The current implementa-
tion allows only one `:' modifier on each `$' expansion.
--karl
More information about the Comp.unix.shell
mailing list