Created
August 17, 2022 02:54
-
-
Save popdemtech/ac4755fa3a2d58038efde4d777589006 to your computer and use it in GitHub Desktop.
Execute a bash script in the current shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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