]> Frank Brehm's Git Trees - my-stuff/tools.git/commitdiff
Fixing confusion about base directory
authorFrank Brehm <frank@brehm-online.com>
Sun, 19 Nov 2017 09:20:17 +0000 (10:20 +0100)
committerFrank Brehm <frank@brehm-online.com>
Sun, 19 Nov 2017 09:20:17 +0000 (10:20 +0100)
bin/convert-stack.sh

index e979037c6e86cd939190d092af256ed925cab3b7..8c0a8beba9c393718d56e0e48df38e5f70dbcfdc 100755 (executable)
@@ -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}' | \