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

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -