Skip to content
April 3, 2014 / Karthikeyan Natarajan

Find scripts folder in bash

we execute the bash scripts directly using ./scripts.sh or using source scripts.sh

sometime we need to create folder in project root DIR or only on scripts folder.  Here is a simple single line command for finding scripts path

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )"

Source: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: