On Fri, Apr 3, 2015 at 4:38 PM, Jan Lehnardt <[email protected]> wrote:
> rootdir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")"

${0} - executable path. like shell
${0%/*} - get parent directory of this path
$(cd ${0%/*}) - execute a shell command
since cd changes current directory, it also updates environment
variable $PWD according it. In case of success you'll be moved to
somewhere like /bin (for me)

--
,,,^..^,,,

Reply via email to