diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 14:35:16 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 14:35:16 +1200 |
commit | 4f9541f1f5e193e252a890062cd01970f2204619 (patch) | |
tree | df091379910710735c2f8db961ecbcc28cd3dd25 | |
parent | Update submodules (diff) | |
download | dotfiles-4f9541f1f5e193e252a890062cd01970f2204619.tar.gz dotfiles-4f9541f1f5e193e252a890062cd01970f2204619.zip |
Suppress stderr from command -v checks
Now I remember--old Bash prints failure messages to stderr for this
call. That'll be why I was suppressing both streams initially.
-rwxr-xr-x | bin/fgscr | 2 | ||||
-rwxr-xr-x | bin/shb | 2 | ||||
-rwxr-xr-x | bin/td | 2 | ||||
-rw-r--r-- | sh/profile.d/keychain.sh | 4 | ||||
-rw-r--r-- | sh/profile.d/pager.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/ed.sh | 2 | ||||
-rw-r--r-- | sh/shrc.d/vim.sh | 2 |
7 files changed, 8 insertions, 8 deletions
@@ -2,7 +2,7 @@ # Find all the Git repositories in a directory and scrub them all # Check we have gscr(1) first -command -v gscr >/dev/null || exit +command -v gscr >/dev/null 2>&1 || exit # Look for any dir named .git in the given (default current) dir and run # gscr(1) on it @@ -14,7 +14,7 @@ scr=$1 intn=$2 shift 2 # Try and find the path to the interpreter command, bail out if we can't -if ! intp=$(command -v "$intn") ; then +if ! intp=$(command -v "$intn" 2>/dev/null) ; then printf >&2 '%s: %s: command not found\n' "$self" "$intn" exit 1 fi @@ -12,7 +12,7 @@ file=${1:-"${TODO_NAME:-todo}"} cd -- "$dir" || exit # If the current directory isn't a Git repository, try to create one -if ! command -v isgr >/dev/null ; then +if ! command -v isgr >/dev/null 2>&1 ; then printf >&2 'isgr: command not found\n' exit 1 fi diff --git a/sh/profile.d/keychain.sh b/sh/profile.d/keychain.sh index a9725bec..55306ad4 100644 --- a/sh/profile.d/keychain.sh +++ b/sh/profile.d/keychain.sh @@ -1,11 +1,11 @@ # ssh-askpass setup -if command -v ssh-askpass >/dev/null ; then +if command -v ssh-askpass >/dev/null 2>&1 ; then SSH_ASKPASS=$(command -v ssh-askpass) export SSH_ASKPASS fi # keychain setup -if command -v keychain >/dev/null ; then +if command -v keychain >/dev/null 2>&1 ; then eval "$(TERM=${TERM:-ansi} keychain \ --eval --ignore-missing --quiet id_dsa id_rsa id_ecsda)" diff --git a/sh/profile.d/pager.sh b/sh/profile.d/pager.sh index a74e6aa1..f0c4fab4 100644 --- a/sh/profile.d/pager.sh +++ b/sh/profile.d/pager.sh @@ -1,6 +1,6 @@ # If we don't have less(1), we'll just use whatever pager the application or # system deems fit -command -v less >/dev/null || return +command -v less >/dev/null 2>&1 || return # Use less(1) as my PAGER PAGER=less diff --git a/sh/shrc.d/ed.sh b/sh/shrc.d/ed.sh index d13c01c9..4638d2cb 100644 --- a/sh/shrc.d/ed.sh +++ b/sh/shrc.d/ed.sh @@ -18,7 +18,7 @@ ed() { # Execute the ed(1) call, in a wrapper if appropriate and with the # concluded options - if [ -t 0 ] && command -v rlwrap >/dev/null ; then + if [ -t 0 ] && command -v rlwrap >/dev/null 2>&1 ; then command rlwrap ed "$@" else command ed "$@" diff --git a/sh/shrc.d/vim.sh b/sh/shrc.d/vim.sh index fc04c99f..e9174082 100644 --- a/sh/shrc.d/vim.sh +++ b/sh/shrc.d/vim.sh @@ -1,5 +1,5 @@ # If Vim exists on the system, use it instead of ex, vi, and view -command -v vim >/dev/null || return +command -v vim >/dev/null 2>&1 || return # Define functions proper ex() { |