A while ago I wrote a script (let's call it myScript) so that it would cd into a specific folder. I saved it in cygwin home directory so I could run it just by calling ~/myScript. I had problems with it, but got it working by calling
. ~/myScript
I have written a parent script (let's call it parentScript) that does few tasks and wanted to add an option so it would cd to my specific directory by calling myScript inside it.
myScript looks something like this:
cd /cygdrive/c/Users/USER_NAME
parentScript has this:
if [ "${1}" -eq CD_TO_USER_NAME_OPTION ]; then . ~/myScript fi
This gives me the same problem I had before with myScript. It cds in the subshell, but then exits leaving me in the directory I started with. I want to be able to run myScript without using the parent that's why I didn't put in parentScript (like grep -E and Egrep). What am I doing wrong??