diff --git a/formatlto b/formatlto index de4d36c..cbe7a3c 100755 --- a/formatlto +++ b/formatlto @@ -4,7 +4,6 @@ version="0.2" SCRIPTDIR=$(dirname "${0}") -. "${SCRIPTDIR}/ltofunctions" || { echo "Missing '${SCRIPTDIR}/ltofunctions'. Exiting." ; exit 1 ;}; _usage(){ echo @@ -18,6 +17,10 @@ _usage(){ exit } +. "${SCRIPTDIR}/ltofunctions" || { echo "Missing '${SCRIPTDIR}/ltofunctions'. Exiting." ; exit 1 ;}; +dependencies=(mkltfs) + + unset MIDDLE_OPTIONS while getopts ":fh" opt ; do case "${opt}" in @@ -30,7 +33,7 @@ done if [ ! "${LTO_ARRAY}" ] ; then if [[ $(uname -s) == "Darwin" ]] ; then - LTO_ARRAY=($(system_profiler SPSASDataType | grep "SCSI Target Identifier" | cut -d : -f2 | xargs)) # try to figure out how many lto decks are attached + LTO_ARRAY=($(system_profiler SPSASDataType | grep "SCSI Target Identifier" | cut -d : -f2 | sort | xargs)) # try to figure out how many lto decks are attached else LTO_ARRAY=(0) # to do: itemize when there are multiple lto drives in Linux fi diff --git a/ltofunctions b/ltofunctions index 0866e75..7fffa63 100644 --- a/ltofunctions +++ b/ltofunctions @@ -45,7 +45,7 @@ _report(){ n) ECHOOPT="-n" ;; # to avoid line breaks after echo esac done - shift $(( "${OPTIND}" - 1 )) + shift $(( ${OPTIND} - 1 )) MESSAGE="$1" echo "${ECHOOPT}" "${COLOR}${START_MESSAGE[@]}${MESSAGE}${NC}" [ "${LOG}" = "Y" ] && _log -w "${MESSAGE}" diff --git a/mountlto b/mountlto index a5c95e3..2dbcc22 100755 --- a/mountlto +++ b/mountlto @@ -5,12 +5,12 @@ SCRIPTDIR=$(dirname "${0}") . "${SCRIPTDIR}/ltofunctions" || { echo "Missing '${SCRIPTDIR}/ltofunctions'. Exiting." ; exit 1 ;}; -unset "${LTO_ARRAY}" -unset "${LTFS_OPTIONS}" +unset LTO_ARRAY +unset LTFS_OPTIONS LTO_LOGS="${HOME}/Documents/lto_indexes" if [[ -z "${LTO_ARRAY}" ]] ; then if [[ $(uname -s) == "Darwin" ]] ; then - LTO_ARRAY=($(system_profiler SPSASDataType | grep "SCSI Target Identifier" | cut -d : -f2 | xargs)) # try to figure out how many lto decks are attached + LTO_ARRAY=($(system_profiler SPSASDataType | grep "SCSI Target Identifier" | cut -d : -f2 | sort | xargs)) # try to figure out how many lto decks are attached else LTO_ARRAY=(0) # to do: itemize when there are multiple lto drives in Linux fi diff --git a/writelto b/writelto index 54b98fb..891931a 100755 --- a/writelto +++ b/writelto @@ -6,7 +6,6 @@ TAPE_MOUNT_POINT="/Volumes" TAPE_SERIAL_REGEX="[A-Z0-9]\{6\}" LTO_LOGS="$HOME/Documents/lto_indexes" SCRIPTDIR=$(dirname "${0}") -. "${SCRIPTDIR}/ltofunctions" || { echo "Missing '${SCRIPTDIR}/ltofunctions'. Exiting." ; exit 1 ;}; _usage(){ echo "writelto" @@ -15,6 +14,8 @@ _usage(){ exit 1 } +. "${SCRIPTDIR}/ltofunctions" || { echo "Missing '${SCRIPTDIR}/ltofunctions'. Exiting." ; exit 1 ;}; + # command-line options OPTIND=1 while getopts ":t:" opt ; do @@ -24,7 +25,7 @@ while getopts ":t:" opt ; do :) echo "Option -${OPTARG} requires an argument" ; exit 1 ;; esac done -shift $(( "${OPTIND}" - 1 )) +shift $(( ${OPTIND} - 1 )) SOURCE_DIR="${1}"