${0##*/}


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ${0##*/}
# 1  
Old 01-07-2009
${0##*/}

Hi all

I have a question

In one of the scripts i saw a log file created as ${0##*/}_log

What is meant by ${0##*/}
# 2  
Old 01-07-2009
Quote:
Originally Posted by vasuarjula
Hi all

I have a question

In one of the scripts i saw a log file created as ${0##*/}_log

What is meant by ${0##*/}

Read the Parameter Expansion section of your shell's man page.

Code:
    ${parameter#word}
    ${parameter##word}

The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches the beginning of the value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ''#'' case) or the longest matching pattern (the ''##'' case) deleted.
# 3  
Old 01-08-2009
${0##*/} is the same as `basename $0` .
i.e. The name the script was call as minus the directory tree.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question