dundalek / closh

Bash-like shell based on Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get absolute location of a script

dundalek opened this issue · comments

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.

Added howto into cookbook.