[CentOS] Get only script name with shell script
William L. Maltby
CentOS4Bill at triad.rr.com
Fri Apr 24 18:39:52 UTC 2009
On Fri, 2009-04-24 at 21:35 +0300, 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 ?
Man "basename". This is used to strip leading path.
>
> Thanks all for help.
>
>
--
Bill
More information about the CentOS
mailing list