dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.61k stars 65 forks source link

Get absolute location of a script #138

Closed dundalek closed 5 years ago

dundalek commented 5 years ago

Following idiom is used in bash to get the absolute location of a script. It is usually used to include or execute scripts relative to its location independently of what the current working directory is:

# Figure out the absoute directory
__dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Now it is possible to reference other files relatively
source ${__dir}/shared.sh

Add some mechanism to get the absolute script path in closh.

dundalek commented 5 years ago

Added howto into cookbook.