1

How to change the working directory of invoking shell using a script?

view story
linux-howto

http://unix.stackexchange.com – I am trying to create few scripts that would change the working directory of the main shell/terminal. Not able to do so. I tried the following File p1.sh #!/bin/bash cd /home/mtk/work/project1 File code.sh #!/bin/bash cd /home/mtk/templates/resusable/sampleCodes But I am aware that the above would change it only for itself i.e. the one running currently, which would be p1.sh or code.sh in this case. Please let me know, how would I be able to change the current working directory for the parent calling shell. Example Run and expectation: $ pwd /home/mtk $ p1.sh $ pwd /home/mtk ### - (HowTos)