SyntaxFix
Write A Post
Hire A Developer
Questions
🔍
[bash] How can I get the source directory of a Bash script from within the script itself?
Home
Question
How can I get the source directory of a Bash script from within the script itself?
I usually use:
dirname $(which $BASH_SOURCE)
Examples related to
bash
•
Comparing a variable with a string python not working when redirecting from bash script
•
Zipping a file in bash fails
•
How do I prevent Conda from activating the base environment by default?
•
Get first line of a shell command's output
•
Fixing a systemd service 203/EXEC failure (no such file or directory)
•
/bin/sh: apt-get: not found
•
VSCode Change Default Terminal
•
Run bash command on jenkins pipeline
•
How to check if the docker engine and a docker container are running?
•
How to switch Python versions in Terminal?
Examples related to
directory
•
Moving all files from one directory to another using Python
•
What is the reason for the error message "System cannot find the path specified"?
•
Get folder name of the file in Python
•
How to rename a directory/folder on GitHub website?
•
Change directory in Node.js command prompt
•
Get the directory from a file path in java (android)
•
python: get directory two levels up
•
How to add 'libs' folder in Android Studio?
•
How to create a directory using Ansible
•
Troubleshooting misplaced .git directory (nothing to commit)