X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=boot;h=83463731ddb57b1a6351f0afd321ea54924e4e51;hp=63fcf5acf3c99befb4e49a0832765def102fcb8a;hb=4d41d9625693246727269be83f7c3dcf6f95cedd;hpb=44ba89f224de85177a1b33359430baf016949267 diff --git a/boot b/boot index 63fcf5a..8346373 100755 --- a/boot +++ b/boot @@ -5,13 +5,23 @@ set -e abs="${BASH_SOURCE[0]}" -if [ "$abs" = "${abs#/}" ];then +if [ -z "$abs" ];then + # bash-2.0 (RHEL3) + abs="`history 1|awk '/\/boot *$/{print $NF}'`" +fi +if [ -n "$abs" -a "$abs" = "${abs#/}" ];then abs="$PWD/$abs" fi -abs="`dirname "$abs"`" -export HOME="$abs" +if [ -z "$abs" ];then + HOME="$PWD" + echo >&2 "WARNING: Defaulting to: HOME=$HOME" +else + abs="`dirname "$abs"`" + HOME="$abs" +fi +export HOME unset abs cd set +e -. .bashrc +. .bash_profile echo OK