I know what I can make a shell procedure or source the script instead of running it to cd the shell I am using. What I want to know is there any way to cd the "parent shell" (not sure if that is the correct phrase).
#!/bin/sh
# This is script.sh
cd $1
pwd
Here's some output. (Note: this isn't the exact output, I just shortened it by stripping out unnecessary details. Lines that are my input into the shell begin with >.)
> mkdir foo
> ./script.sh foo
/home/myName/foo
> pwd
/home/myName
This is expected behavior as I understand. Here is if I "source" the script.
> . ./script.sh foo
/home/myName/foo
> pwd
/home/myName/foo
Without sourcing the script and without making this a shell procedure, is there any way to type ./script.sh foo result in the shell I am using be in the directory /home/myName/foo?