I am trying to go into a directory using pushd
#!/bin/bash
function cloneAll {
[ -d ~/mapTrials ] || mkdir ~/mapTrials
pushd '~/mapTrials/'
echo $(pwd)
popd
}
The echo $(pwd) gives me the same working directory that I called the script from.
I read in other SO answers that pushd is only for child processes and that I have to create an alias for it. I have done that also.
I tried doing some commands like mkdir to see where it would be created. It is being created in the directory I called the script from and not the directory specified in pushd.
How do I get this working? How do I get into a specific directory in a shell script and then do commands inside that directory??
Thanks in advance.