One of the most frustrating moments for a Textsmith is writing a script to ’teleport’ to a project folder, only to find yourself standing exactly where you started once the script ends.
The Child and the Parent
When you execute a script (./script.sh), Linux creates a ‘Child Process.’ This child can pushd and popd all it wants, but it is a ghost. When the script ends, the child vanishes, and the Parent shell remains unmoved.
The ‘Source’ Strike
To make the changes ‘stick’ to your current terminal, you must use the source command (or the dot . operator).
source ./teleport.sh
This tells your shell: ‘Do not create a child. Execute these commands right here, in the main forge.’
The Textsmith’s Alias
If you have a frequent teleportation ritual, don’t just write a script—write an Alias or a Function in your .bashrc. These always run in the current shell, making pushd and popd behave exactly as you expect.
Forged in the terminal. Refined under the anvil.