From fdcfb61f0b1cd8f61a5a43ad91d08d76307063f5 Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Thu, 5 Sep 2013 01:29:18 +0200 Subject: [PATCH] Distinguish different bash-versions and how they find out about the source file --HG-- branch : bgschaid/minorAdditionsBranch --- etc/bashrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/bashrc b/etc/bashrc index e66241708..5c110fe2f 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -46,7 +46,14 @@ export WM_PROJECT_VERSION=1.6-ext if [ -z "$WM_PROJECT_VERSION_ADDITION" ] then - export WM_PROJECT_VERSION_ADDITION=`python -c "from os.path import *;print abspath(join(curdir,'$0')).split(sep)[-3][len('OpenFOAM-$WM_PROJECT_VERSION')+1:]"` + thisScript="${BASH_SOURCE[0]}" + if [ ! -n "$thisScript" ] + then + # this is vor bash version < 4 and zsh + thisScript=$0 + fi + export WM_PROJECT_VERSION_ADDITION=`python -c "from os.path import *;print abspath(join(curdir,'$thisScript')).split(sep)[-3][len('OpenFOAM-$WM_PROJECT_VERSION')+1:]"` + unset thisScript fi if [ -n "$WM_PROJECT_VERSION_ADDITION" ]