Welcome to my blog, a treasure trove of practical information and real-life experiences. I share valuable tips, life hacks, and lessons learned from day-to-day encounters. From productivity to wellness advice, let's explore life's ups and downs, finding inspiration in ordinary moments. Join me on this journey to make each day more fulfilling and successful.
01 November, 2009
How to get self directory in bash script
This makes variable $SELF_DIR where is location of that script:
SELF_DIR=$(cd $(dirname $0); pwd -P)
This does the same thing as the first one but it adds the script file name to the variable:
What about linked scripts, like init ones?
ReplyDeleteMy choice:
SELF_DIR=$( dirname $(readlink -f $0) )