![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Whats Telnet for? | epic.admin | UNIX for Dummies Questions & Answers | 16 | 07-02-2006 04:09 AM |
| Whats Behind Your Name? | What's on Your Mind? | 66 | 10-18-2005 08:40 PM | |
| Whats the go? | Neo | Post Here to Contact Site Administrators and Moderators | 1 | 10-01-2004 12:52 PM |
| Whats does this mean | jyotipg | Shell Programming and Scripting | 1 | 04-06-2004 08:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
hi all,
i found NAME=${0##*/} in a script. i given this coomand in my unix box(presently in ksh). echo ${0##*/} it returned ksh. the purpose of the above is to return the shell name or more than that. do you have any more information like this, please share with me. one more query what is set -xv and +xv. i read the above with "man". but i am not clear with that. |
|
|||||
|
I guess as they say, RTFM more carefully. Just kidding.
![]() NAME=${0##*/} simply gets the name of the currently executing script. The $0 is what does it, and the rest strips of the leading path names. It's useful when the script name is supposed to different things depending on how its invoked. For instance, if you have a softlink to your script named "foo" and another softlink named "bar", then your script can do print out "FU" instead of "Beyond All Recognition". Or something. set -xv +xv are shorthand for Code:
set -x set -v |
|
|||||
|
NAME=${0##*/} is a fancy awy of doing "basename $0"
$0 is a special variable that hold the name of the script (or if you doit in a loguin shell, the name of the shell), including the full path to the executable the other ##, well, is complicated and must admit i dont know why it works, to advanced for me if you want, you can read the "basename" man page to get a grasp of what it does |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|