QUIET='n'
SIMULATE="n"
-VERSION="0.2"
+VERSION="0.3"
# console colors:
RED=""
exit 5
fi
- if [[ -n "${LINK_DIR}" && ! -d "${LINK_DIR}" ]] ; then
- error "Given link directory '${RED}${LINK_DIR}${NORMAL}' does not exists."
- exit 1
+ if [[ -n "${LINK_DIR}" ]] ; then
+ if [[ ! -d "${LINK_DIR}" ]] ; then
+ error "Given link directory '${RED}${LINK_DIR}${NORMAL}' does not exists."
+ exit 1
+ fi
+ LINK_DIR=$( readlink --canonicalize "${LINK_DIR}" )
+ debug "Directory for hard links is: '${LINK_DIR}'."
fi
}
##
################################################################################
+#------------------------------------------------------------------------------
+perform_csv() {
+
+ local lnr=0
+ local oifs="${IFS}"
+ IFS="
+"
+
+ local -a lines=()
+ local line=
+
+ for line in $( cat "${CSV_FILE}" ); do
+ lines+=( $line )
+ done
+ IFS="$oifs"
+
+ for line in "${lines[@]}" ; do
+
+ lnr=$(( $lnr + 1 ))
+
+ if echo "${line}" | egrep -q '^[ ]*(#.*)?$' ; then
+ debug "Don't evaluate line ${lnr}: ${line}"
+ continue
+ fi
+ debug "Evaluating line ${lnr}: ${line}"
+
+ done
+
+}
+
#------------------------------------------------------------------------------
main() {
get_options "$@"
+ if [[ "${SIMULATE}" == "y" ]] ; then
+ info "Simulation mode, nothing will be really done."
+ echo
+ fi
+
+ cd $( dirname "${CSV_FILE}" )
+ debug "Current directory is now: '$( pwd )'."
-# prepare_dirs
-# info "Starting backup ..."
-# cleanup_old_backups
-# get_zones
-# backup_zones
+ info "Starting stack converting ..."
+ perform_csv
-# empty_line
+ echo
info "Finished."
}