From 90bed2a183c9c6df1f3f3360b2c9e486c4a0ca77 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 23 Oct 2014 23:05:01 +0200 Subject: [PATCH] Use command -v (built-in) instead of which(1) (Thanks val) fixes #1380 --- i3-sensible-editor | 2 +- i3-sensible-pager | 2 +- i3-sensible-terminal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/i3-sensible-editor b/i3-sensible-editor index b3afceb7..4e7456b7 100755 --- a/i3-sensible-editor +++ b/i3-sensible-editor @@ -10,7 +10,7 @@ # Hopefully one of these is installed (no flamewars about preference please!): for editor in $VISUAL $EDITOR nano vim vi emacs pico qe mg jed gedit mc-edit; do - if which $editor > /dev/null 2>&1; then + if command -v $editor > /dev/null 2>&1; then exec $editor "$@" fi done diff --git a/i3-sensible-pager b/i3-sensible-pager index df463251..5ad78606 100755 --- a/i3-sensible-pager +++ b/i3-sensible-pager @@ -12,7 +12,7 @@ # We don't use 'more' because it will exit if the file is too short. # Worst case scenario we'll open the file in your editor. for pager in $PAGER less most w3m i3-sensible-editor; do - if which $pager > /dev/null 2>&1; then + if command -v $pager > /dev/null 2>&1; then exec $pager "$@" fi done diff --git a/i3-sensible-terminal b/i3-sensible-terminal index fddefae1..485fc16d 100755 --- a/i3-sensible-terminal +++ b/i3-sensible-terminal @@ -9,7 +9,7 @@ # distribution-specific mechanism to find the preferred terminal emulator. On # Debian, there is the x-terminal-emulator symlink for example. for terminal in $TERMINAL urxvt rxvt terminator Eterm aterm xterm gnome-terminal roxterm xfce4-terminal; do - if which $terminal > /dev/null 2>&1; then + if command -v $terminal > /dev/null 2>&1; then exec $terminal "$@" fi done