Set Current Working Directory To Parent Path Of Bash Shell Script

Posted by Weston Ganger

I needed to reference another relative script from another script. This is fairly common. Heres how to set this up for your bash scripts.

parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"

Related External Links:

Article Topic:Software Development - Linux

Date:August 26, 2020

Recommended Posts



Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected