Sponsored Content
Full Discussion: ${0##*/}
Top Forums Shell Programming and Scripting ${0##*/} Post 302274493 by cfajohnson on Wednesday 7th of January 2009 05:19:16 PM
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.
 
MESSAGES(3)						  libbash messages Library Manual					       MESSAGES(3)

NAME
messages -- libbash library that implements a set of functions to print standard status messages SYNOPSIS
printOK [indent] printFAIL [indent] printNA [indent] printATTN [indent] printWAIT [indent] DESCRIPTION
General messages is a collection of functions to print standard status messages - those [ OK ] and [FAIL] messages you see during Linux boot process. The function list: printOK Prints a standard [ OK ] message (green) printFAIL Prints a standard [FAIL] message (red) printNA Prints a standard [ N/A] message (yellow) printATTN Prints a standard [ATTN] message (yellow) printWAIT Prints a standard [WAIT] message (yellow) Detailed interface description follows. indent Column to move to before printing. Default indent is calculated as TTY_WIDTH-10. If current tty width can not be determined (for example, in case of serial console), it defaults to 80, so default indent is 80-10=10 FUNCTIONS DESCRIPTIONS
printOK [indent] Prints a standard [ OK ] message (green) printFAIL [indent] Prints a standard [FAIL] message (red) printNA [indent] Prints a standard [ N/A] message (yellow) printATTN [indent] Prints a standard [ATTN] message (yellow) printWAIT [indent] Prints a standard [WAIT] message (yellow) EXAMPLES
Run a program named MyProg, and report it's success or failure: echo -n 'Running MyProg...' printWAIT if MyProg ; then printOK else printFAIL fi AUTHORS
Hai Zaar <haizaar@haizaar.com> Gil Ran <gil@ran4.net> SEE ALSO
ldbash(1), libbash(1) Linux Epoch Linux
All times are GMT -4. The time now is 04:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy