From: Chris Koeritz Date: Mon, 13 Feb 2012 20:54:54 +0000 (-0500) Subject: falling back if which is not a valid command. X-Git-Tag: 2.140.90~1605 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=a6d593934f34d35642cdc8a79421404560f89fe1;p=feisty_meow.git falling back if which is not a valid command. --- diff --git a/examples/custom_overrides/fred/java_profile.sh b/examples/custom_overrides/fred/java_profile.sh index 69cb9308..423e99d5 100644 --- a/examples/custom_overrides/fred/java_profile.sh +++ b/examples/custom_overrides/fred/java_profile.sh @@ -6,6 +6,17 @@ ############################ +function whichable() +{ + to_find="$1"; shift + which which &>/dev/null + if [ $? -ne 0 ]; then + # there is no which command here. we produce nothing due to this. + echo + fi + echo $(which $to_find) +} + # this reports when we have totally failed to figure out where a folder # is actually located on the machine. function intuition_failure() @@ -63,7 +74,7 @@ if [ ! -d "$JAVA_HOME" ]; then JAVA_BIN_PIECE=Commands fi # last thing is to tell them we couldn't find it. -if [ ! -d "$JAVA_HOME" -a -z "$(which java 2>/dev/null)" ]; then +if [ ! -d "$JAVA_HOME" -a -z "$(whichable java 2>/dev/null)" ]; then intuition_failure JAVA_HOME unset JAVA_BIN_PIECE fi @@ -94,7 +105,7 @@ if [ ! -d "$ECLIPSE_DIR" ]; then ECLIPSE_DIR="/e/tools/eclipse" fi # final option is to whine. -if [ ! -d "$ECLIPSE_DIR" -a -z "$(which eclipse 2>/dev/null)" ]; then +if [ ! -d "$ECLIPSE_DIR" -a -z "$(whichable eclipse 2>/dev/null)" ]; then intuition_failure ECLIPSE_DIR fi