![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| please explain the below | mail2sant | Shell Programming and Scripting | 1 | 04-04-2008 05:04 AM |
| Please can any one explain this ${0##/} | gadege | Shell Programming and Scripting | 2 | 04-01-2008 12:26 PM |
| please explain this | dummy_needhelp | Shell Programming and Scripting | 2 | 10-14-2007 10:17 PM |
| if [ $? -eq 0 ] .. can someone explain this? | ranjita.c | Shell Programming and Scripting | 5 | 10-03-2006 04:50 PM |
| Explain awk | hitmansilentass | Shell Programming and Scripting | 4 | 09-27-2006 11:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Can anyone explain plz
HI,
Can anyone explain to me how does the following command work - > current_dir=`cd \`/usr/bin/dirname $0\` && pwd` Regards, Ranga |
| Forum Sponsor | ||
|
|
|
|||
|
Code:
$ cat spt echo $0 current_dir=`cd \`/usr/bin/dirname $0\` && pwd` echo "current_dir="$current_dir $ /db2home/training/anbu/spt /db2home/training/anbu/spt current_dir=/db2home/training/anbu pwd assign the directory to current_dir where script resides. Instead of above code you can use this Code:
current_dir=`/usr/bin/dirname $0` Last edited by anbu23; 03-27-2007 at 12:04 AM. |
|
|||
|
cd \`/usr/bin/dirname $0\` just change directory
In the following code this cd is done within `..` which will open new shell and change directory. So if you come out this line you will be in the same directory as before executing this line. Code:
current_dir=`cd \`/usr/bin/dirname $0\` && pwd` |
|||
| Google The UNIX and Linux Forums |