From: Francois Fleuret Date: Tue, 31 Jan 2012 07:11:32 +0000 (+0100) Subject: Unset PHO_NOTE_x variables when possible. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=0fb8308d2117d02eedcd003721606dea8bb796dc;p=scripts.git Unset PHO_NOTE_x variables when possible. --- diff --git a/bashrc b/bashrc index d84d7c9..f3d033a 100644 --- a/bashrc +++ b/bashrc @@ -292,15 +292,20 @@ function map () { ## variables function pho () { - PHO_BIN=$(which pho) TEMP=$(mktemp /tmp/pho.XXXXXXX) - ${PHO_BIN} "$@" | tee ${TEMP} + $(which pho) "$@" | tee ${TEMP} PHO_NOTE_1=$(grep ^"Note 1: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_2=$(grep ^"Note 2: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_3=$(grep ^"Note 3: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R90=$(grep ^"Rotate 90 \(CW\): " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R180=$(grep ^"Rotate 180: " ${TEMP} | sed -e "s/^[^:]*: //") PHO_NOTE_R270=$(grep ^"Rotate -90 \(CCW\): " ${TEMP} | sed -e "s/^[^:]*: //") + [[ "${PHO_NOTE_1}" ]] || unset PHO_NOTE_1 + [[ "${PHO_NOTE_2}" ]] || unset PHO_NOTE_2 + [[ "${PHO_NOTE_3}" ]] || unset PHO_NOTE_3 + [[ "${PHO_NOTE_R90}" ]] || unset PHO_NOTE_R90 + [[ "${PHO_NOTE_R180}" ]] || unset PHO_NOTE_R180 + [[ "${PHO_NOTE_R270}" ]] || unset PHO_NOTE_R270 \rm ${TEMP} }