Skip to content

Instantly share code, notes, and snippets.

@popdemtech
Created August 17, 2022 02:54
Show Gist options
  • Select an option

  • Save popdemtech/ac4755fa3a2d58038efde4d777589006 to your computer and use it in GitHub Desktop.

Select an option

Save popdemtech/ac4755fa3a2d58038efde4d777589006 to your computer and use it in GitHub Desktop.
Execute a bash script in the current shell
#!/bin/bash
echo 'alias ppwwdd="pwd"' >> ~/.bashrc
source ~/.bashrc
ppwwdd
# Execute Shell Script Using . ./ (dot space dot slash)
# Executing a shell script using “dot space dot slash”
# will execute the script in the current shell without forking a sub-shell.
# . ./ executes the commands specified by the script in the current shell,
# and can be used to prepare the working environment.
# If this script is run ./dot-space.sh
# an error `ppwwdd: command not found` will output to the console
# If this script is run . ./dot-space.sh
# the working directory will be printed to the console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment