bash - How to run 'cd' in shell script and stay there after script finishes? -


i used 'change directory' in shell script (bash)

#!/bin/bash alias mycd='cd some_place' mycd pwd 

pwd prints some_place correctly, after script finished current working directory doesn't change.

is possible change path script?

you need source file as:

. myfile.sh 

or

source myfile.sh 

without sourcing changes happen in sub-shell , not in parent shell invoking script. when source file lines in file executed if typed @ command line.


Comments

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -