From: Mark Wooding Date: Tue, 13 Feb 2007 23:56:38 +0000 (+0000) Subject: bash_profile: Split check-for-program code into its own function. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/2041672dbfb29ef4baf4a73118edd6bdf8fcc106?ds=inline;hp=-c bash_profile: Split check-for-program code into its own function. I'll want this later on. --- 2041672dbfb29ef4baf4a73118edd6bdf8fcc106 diff --git a/bash_profile b/bash_profile index 22931b0..287f3cb 100644 --- a/bash_profile +++ b/bash_profile @@ -80,6 +80,10 @@ if [ -d /usr/local/plan9 ]; then $PLAN9/bin fi +# --- Find whether a program exists --- + +__mdw_programp () { type -t >/dev/null "$1"; } + # --- And the same for manual pages --- case "$MACHTIME" in @@ -103,7 +107,7 @@ export QMAILINJECT=c export EDITOR=ed for ed in "emacs21 -nw" "emacs -nw" vi pico nano ae; do name=`echo $ed | sed 's/ .*$//'` - if type -t >/dev/null "$name"; then + if __mdw_programp "$name"; then EDITOR=$ed break fi