Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!iconsys!mday From: mday@iconsys.icon.com (Matt Day) Newsgroups: comp.unix.shell Subject: Re: csh question (and ksh port maybe) Message-ID: <1990Nov9.193254.7902@iconsys.icon.com> Date: 9 Nov 90 19:32:54 GMT References: <45969@sequent.UUCP> Organization: Sanyo/Icon International, Inc., Orem, Utah Lines: 40 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. Here's a little set of examples (note: I use the tcsh; I don't think the tcsh and the csh behave differently here, but they might): > set tmp="/usr/tmp/foo.bar.howdy" > echo $tmp:e # (extension) Returns the text to the right of the last '.' bar > echo $tmp:h # (head) Returns the "head" of the path /usr/tmp > echo $tmp:t # (tail) Returns the "tail" (or basename) of the path foo.bar.howdy > echo $tmp:r # (root) Returns everything except for the last '.' extension /usr/tmp/foo.bar The :q and :x modifiers are means of setting the high bit on the variable contents. :x will set the high bit on all the text in the string except for spaces and tabs, and :q will set the high bit on everything. I can't see very many practical uses for this feature. As for the :gh, :gt, and :gr modifiers, they seem to do weird things on my copy of tcsh. Perhaps they're broken, perhaps I just don't understand what their purpose is. In any case, I don't know what they really do. I think the 'g' means "global" somehow, but I can't tell right off. Anyway, that ought to get you started. Those modifiers are really handy, I use them all the time. Saves lots of typing, and in shell scripts, they save a call to "sed". >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. Sorry, I don't know about the ksh. -- - Matt Day, Sanyo/Icon, mday@iconsys.icon.com || uunet!iconsys!mday