basename $0

hi,

can anyone help me by saying what is basename..
i have seen this in many programs where the basename is used....

thanks,

Krips

man basename will tell you all

hi,

thanks... i have seen this in the shell scripts just to assign it to a variable which will be saying the progrma name..
like PRG_NME=basename $0

it will be of great help if someone can explain all about it more clearly..

thanks,

Krips.

The 'basename $0' returns the filename.

'basename' returns the filename string without any path info
eg. aFile instead of /aDirectory/anotherDirectory/aFile

$0 returns the first argument of a command line string, usually the command or appliction name

eg. cat someFile

$0 would return cat, $1 would return someFile