[CentOS] Get only script name with shell script

Paul Heinlein heinlein at madboa.com
Fri Apr 24 19:45:26 UTC 2009


On Fri, 24 Apr 2009, Semih Gokalp wrote:

> Hi all,
>
> I wrote shell script and put it under the /usr/local/bin/ directory.
>
> I use echo $0 for get script name but it has printed
> "/usr/local/bin/<scriptname>" but  i want to only print <scriptname>
>
> How can i do this ?

$(basename $0)

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/


More information about the CentOS mailing list