| Author |
this="${0##*/}"
|
zb cong
Ranch Hand
Joined: Jan 14, 2002
Posts: 403
|
|
hello i read a kshell script, find a line as---this="${0##*/}" in the beginning part of the script, i have check the document, and can't figure out what on earth it mean,please help me. thank you
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8259
|
|
Have you tried typing it into a shell and seeing what it does? Remember, a shell script is just a series of commands. When I do it in a Cygwin Bash shell, I get the name of the shell: Another clue is how the variable is used from then on? Is it compared to values? Used in calculations?
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
zb cong
Ranch Hand
Joined: Jan 14, 2002
Posts: 403
|
|
yes, you are right, in the script, it used to get the script name. but what i feel stranged is the content---0##*/, what is it? it is not a unix command and i can't find it from kshell document, so it is not the syntax of kshell, originally, it seem like the regular expression. but it is not. WHAT ON EARTH IS IT? thanks
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8259
|
|
|
It's the shell syntax for parameter substitution.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
Wow. If I typed words like that, I'd get my mouth washed out with soap. Seriously, it's an interesting little critter that runs a regular expression on a shell parameter. Here's a snipper from the ksh man page:
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: this="${0##*/}"
|
|
|