rename v. script

Matthew Miller mattdm at mattdm.org
Fri May 20 20:22:28 UTC 2005


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 :

-- 
Matthew Miller           mattdm at mattdm.org        <http://www.mattdm.org/>
Boston University Linux      ------>                <http://linux.bu.edu/>
Current office temperature: 79 degrees Fahrenheit.




More information about the fedora-list mailing list