From: Frank Brehm Date: Sun, 19 Nov 2017 09:20:17 +0000 (+0100) Subject: Fixing confusion about base directory X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=21f79940dc3e72c13bbd4c5a1aaf8416e85cfcbc;p=my-stuff%2Ftools.git Fixing confusion about base directory --- diff --git a/bin/convert-stack.sh b/bin/convert-stack.sh index e979037..8c0a8be 100755 --- a/bin/convert-stack.sh +++ b/bin/convert-stack.sh @@ -11,7 +11,7 @@ DEBUG="n" QUIET='n' SIMULATE="n" -VERSION="0.4" +VERSION="0.5" # console colors: RED="" @@ -241,6 +241,8 @@ get_options() { error "CSV file '${RED}${CSV_FILE}${NORMAL}' does not exists." exit 1 fi + BASE_DIR=$( dirname "${CSV_FILE}" | xargs readlink --canonicalize ) + debug "New base dir is now '${BASE_DIR}'." if [[ ! -x "${CONVERT_SCRIPT}" ]] ; then error "Conversion script '${CONVERT_SCRIPT}' not found" @@ -453,8 +455,8 @@ perform_csv() { fi debug "Evaluating line ${lnr}: ${line}" - cd $( dirname "${CSV_FILE}" ) - debug "Current base directory is now: '$( pwd )'." + cd "${BASE_DIR}" + #debug "Current base directory is now: '$( pwd )'." directory=$( echo "${line}" | \ awk -F"${FIELD_SEPARATOR}" '{print $1}' | \