Computing.Net > Forums > Unix > Changing directory

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Changing directory

Reply to Message Icon

Name: ravi.kumar
Date: April 27, 2005 at 05:19:03 Pacific
OS: Unix
CPU/Ram: 256MB
Comment:

Hi,
I have a directory A in my home dir, I need a script to change to dir A, after executing the script I shouldn't be in my home dir (i.e pwd should show /home dir/A) how can I do this

Hello I am working extensively on SCM and Unix



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: April 27, 2005 at 07:21:14 Pacific
Reply:

Hi:

Executing a shell script spawns a child shell. In order for your directory changes for to remain in effect once the child terminates, you must "source" the script:

. myscript.ss

For sh/ksh/bash scripts, from the command-line, that is a period, a space, and the script name.

Regards,

Nails


0

Response Number 2
Name: Luke Chi
Date: April 27, 2005 at 08:41:55 Pacific
Reply:

I created many alias in my .profile file, like:

alias _o='cd $ORACLE_HOME; pwd'
alias _j='cd $J2EE_HOME; pwd'
alias _p='cd $APACHE_HOME; pwd'
alias _b='cd $B2B_HOME; pwd'
...

then, for example
$ _o
$ /u01/oracle/product/10.1.0/Edge/j2ee/home


Luke Chi


0

Response Number 3
Name: ravi.kumar
Date: April 27, 2005 at 22:17:34 Pacific
Reply:

Hi,

Thanx, it worked

Hello I am working extensively on SCM and Unix


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Changing directory

Change directory www.computing.net/answers/unix/change-directory-/2688.html

changing directories www.computing.net/answers/unix/changing-directories/5784.html

Novice - change dir in shell script www.computing.net/answers/unix/novice-change-dir-in-shell-script/4762.html