![]() |
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 |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| please explain the below | mail2sant | Shell Programming and Scripting | 1 | 04-04-2008 08:04 AM |
| Please can any one explain this ${0##/} | gadege | Shell Programming and Scripting | 2 | 04-01-2008 03:26 PM |
| please explain this | dummy_needhelp | Shell Programming and Scripting | 2 | 10-15-2007 01:17 AM |
| if [ $? -eq 0 ] .. can someone explain this? | ranjita.c | Shell Programming and Scripting | 5 | 10-03-2006 07:50 PM |
| Explain awk | hitmansilentass | Shell Programming and Scripting | 4 | 09-27-2006 02:14 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 03: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` |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|