From 5ad945b674eb806a6d5d8c8d7109e7b2ea8786dd Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Tue, 28 Aug 2018 01:25:12 +0000 Subject: [PATCH] misc/qubes-run-terminal: which -> type 'which' is an external tool, 'type' is a shell builtin. Using the latter shaves off a bit of latency. Also use the already open stderr file descriptor for redirection. --- misc/qubes-run-terminal | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/qubes-run-terminal b/misc/qubes-run-terminal index 73b705d..00b7bdc 100755 --- a/misc/qubes-run-terminal +++ b/misc/qubes-run-terminal @@ -2,10 +2,11 @@ # Try to find a terminal emulator that's installed and run it. for terminal in x-terminal-emulator gnome-terminal xfce4-terminal konsole urxvt rxvt termit terminator Eterm aterm roxterm termite lxterminal mate-terminal terminology st xterm; do - if which $terminal >/dev/null 2>&1 ; then + # bogus warning from ShellCheck < 0.5.0 + # shellcheck disable=SC2039 + if type "$terminal" >/dev/null 2>&1 ; then exec "$terminal" fi done -echo "ERROR: No suitable terminal found." > /dev/stderr - +echo "ERROR: No suitable terminal found." >&2