On Friday, May 20th 2005 at 16:22 -0400, quoth Matthew Miller: =>On Fri, May 20, 2005 at 09:05:35PM +0100, THUFIR HAWAT wrote: =>> > basename will strip off any leading directory components, and =>> > optionally any suffix. =>> is basename a reserved word? => =>There aren't any, as such. I can, if I'm crazy, do things like: => =>$ cd=foo =>$ echo $cd =>foo => =>However, there are various commands built in to each shell. Some, like 'cd', =>'fg', 'set', or 'trap' are builtins because they inherently have to be part =>of the shell. Others like 'test' and 'echo' are included in shells like bash =>just for performance because they're so common. => =>Others, like the 'basename' command -- or like cp or mv or whatever -- are =>just regular executable files that by long Unix tradition (and some by =>various specifications) you can just expect to be there. => =>You can find out what type of thing a specific command is by using the =>'type' builtin. (If you're coming from DOS like I was a long time go, it's =>quite surprising that type != cat. But it's actually useful on its own.) Try =>these: => => type basename => type cd => type mv => type ls => type test => type : Mathew. as you noted, the basename command is a seperate Unix program found in /bin. It's usually associated with dirname (also in the same place) because they are usually used together. They are not builtin to any shell. So in order to use them you have to create a subprocess and capture the output to see the results. > foo=/a/b/c/dee.f > basename $foo dee.f > dirname $foo /a/b/c But you're much better off not using any external programs when you have the choice of using real builtin stuff. > echo ${foo##*/} ${foo%/*} dee.f /a/b/c -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net