On 02/19/2017 05:22 AM, Mike Wright wrote:
Hi all,
My brain cell ran away from home. I have an incredibly simple script
that doesn't do what I expect. I use "mkdir DIR; cd DIR" a lot so I'm
trying to put it in a script: "~/bin/mdcd".
After checking that $1 exists:
dir="$1"
mkdir -p "$dir"
cd "$dir" <------ never executes
The directory is created so there is no error there.
Huh? Insight anyone?
I'm not sure why this doesn't work but you're doing it the hard way.
mkdir -p $1
cd $1
is much simpler, and might work better.