Linux: Change working directory to script directory in bash

Hi,

short post. You start a bash script and want to change the working directory to the directory where the script is stored

Use this:

cd "$(dirname "$0")"

Michael

Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.