COHERENT manpages

This page displays the COHERENT manpage for basename [Strip path information from a file name].

List of available manpages
Index


basename -- Command

Strip path information from a file name
basename file [ suffix ]

basename strips  its argument file  of any leading  directory prefixes.  If
the result contains the optional suffix, basename also strips it.  basename
prints the result on the standard output.

For example, the command

    basename /usr/fred/source.c

returns

    source.c

basename is  most useful when  it is used  with other shell  commands.  For
example, the command

    for i in *.c
    do
        cp $i `basename $i .c`.backup
    done

copies every  file that has  the suffix .c  into an identically  named file
that has the suffix .backup.

See Also

commands,
ksh,
sh