![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| running script in any directory | shinjeck | SUN Solaris | 1 | 10-26-2007 02:23 AM |
| Calling a script from any directory | ketanr | Shell Programming and Scripting | 1 | 10-17-2007 01:16 PM |
| Change Directory via a script? | George Borrmann | Shell Programming and Scripting | 3 | 10-09-2006 05:13 PM |
| Changing directory through script | mrgubbala | UNIX for Dummies Questions & Answers | 5 | 02-11-2005 07:12 AM |
| Using ls in a script for another directory | jagannatha | UNIX for Dummies Questions & Answers | 17 | 06-05-2003 03:52 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
script for chainging the directory
#!/bin/sh
echo "Enter the Num" read $i cd /aa/$i/abc when i execute the above i am getting the error where $i=205 another point is i have just place #!/bin/sh cd /aa/205/abc when i execute this i am unable to change the directory... but i am able to login by /home/cvs cd /aa/205/abc here i am able to change the directory.. /aa/205/abc Any inof on this... |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
In reverse order:
When you change directories in a child process, when the child process exits, the parent proces (the one that called the script) is where it started. No change. Code:
. myscript.sh It makes the process run in the parent, not a child. So, if the script changes directories it will "stick" in the parent process. The first question Code:
echo "enter something \c" read i # notice NO $ in front of i echo "$i" # now we need a $ |
|||
| Google The UNIX and Linux Forums |