I’m writing a bash script. I need the current working directory to always be the directory that the script is located in.
The default behavior is that the current working directory in the script is that of the shell from which I run it, but I do not want this behavior.
Good Answer: 👌👌👌
#!/bin/bash cd "$(dirname "$0")"
Read More: 👉 https://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script