Shell script [message #433269] |
Tue, 01 December 2009 02:55 |
prejib
Messages: 126 Registered: March 2009 Location: India
|
Senior Member |
|
|
Hi,
I want to write an executable file in unix env to go to a particular path instead of always typing the long path cd /app/oracle/product/10.2.0/Db_1/scripts/prejib/sample.
I have tried with the below script in but not working . please help me
bash-3.00$ cat a.sh#!/bin/sh
mypath=/app/oracle/product/10.2.0/Db_1/scripts/pressy/sample
echo $mypath
cd $mypath
bash-3.00$ chmod +x a.sh
bash-3.00$ sh a.sh
/app/oracle/product/10.2.0/Db_1/scripts/pressy/sample
bash-3.00$ pwd
/app/oracle/product/10.2.0/Db_1/scripts/pressy
bash-3.00$
After executing the file a.sh, I am in the same path only
|
|
|
Re: Shell script [message #433276 is a reply to message #433269] |
Tue, 01 December 2009 03:21 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Because you start a new shell.
When you run
You start a new shell, and that new shell runs a.sh, and then closes again so you are again in your old shell where nothing has changed.
Try running just "a.sh" in your current shell.
|
|
|
Re: Shell script [message #433277 is a reply to message #433269] |
Tue, 01 December 2009 03:22 |
|
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
This question bears no real connection with Oracle.
Please find a more appropriate forum.
The topic is locked.
Regards
Michel
|
|
|