This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Linux / UNIX and the fly likes this= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "this="${0##*/}"" Watch "this="${0##*/}"" New topic
Author

this="${0##*/}"

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
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: 8876
    
    8

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: 416
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: 8876
    
    8

It's the shell syntax for parameter substitution.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

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: http://aspose.com/file-tools
 
subject: this="${0##*/}"