Hi Can anyone help me with this. Im new to doing scripts. Thanks

I am writing a simple script to cd to another directory. But the directory does not change after running the script. How can i make the directory change after running the script?

operator@tiger013s% pwd

/export/home/tiger013s/operator

operator@tiger013s% more sample

#!/bin/csh

cd /home/local_summary

operator@tiger013s% sample

operator@tiger013s% pwd

/export/home/tiger013s/operator -> i want to be in /home/local_summary

Hi,

Remove "#!/bin/csh" from your script. This instructs the shell to begin a new shell session to execute your script. This is why it does not change your 'current' directory. It is the 'new' shell session which changes directory and then that session exits when the script is done.

Kate

And. You have to source the script. It may or may not run in a subshell (another process) with

[b].[/b] myfscript.sh

note the leading dot - in linux there is the source command in bash which does the same thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.