diff --git a/.bash_completion.d/aws b/.bash_completion.d/aws index 73844cf226651b8ba498853ea7612c0026e87ca2..8932d45d10665583e0c578f069393e8dc0a44796 100644 --- a/.bash_completion.d/aws +++ b/.bash_completion.d/aws @@ -1 +1 @@ -! which aws_completer >/dev/null || complete -C 'aws_completer' aws +! command -v aws_completer >/dev/null || complete -C 'aws_completer' aws diff --git a/.bashrc b/.bashrc index 3f8b1e3e92690652984672a9e465c8a4cb757743..561cd6385dc46c01dc6cd625f7ec3b7300025126 100644 --- a/.bashrc +++ b/.bashrc @@ -191,7 +191,7 @@ then do [ ! -f "$sourcefile" ] || . "$sourcefile" done - ! which direnv > /dev/null || eval $(direnv hook bash) + ! command -v direnv > /dev/null || eval $(direnv hook bash) fi diff --git a/Documents/bin/boxssh b/Documents/bin/boxssh index 9f89d93f9ba93221ecae4e4b59afd0f2dca910d3..570e2623da1b37f7070e7949b93156308f8644df 100755 --- a/Documents/bin/boxssh +++ b/Documents/bin/boxssh @@ -6,7 +6,7 @@ die () { exit 1 } -which ip > /dev/null || die "Can't find ip." +command -v ip > /dev/null || die "Can't find ip." alias ssh='ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i "$HOME/.ssh/bullguard-box_rsa" -l root -p 64222' diff --git a/Documents/bin/dconf-load b/Documents/bin/dconf-load index 07070bfea096ec17e318832f3b22edd3708ddd25..eafc88dd6d07322570b1a0f0f9c511e5a378aad2 100755 --- a/Documents/bin/dconf-load +++ b/Documents/bin/dconf-load @@ -1,7 +1,7 @@ #!/bin/sh set -eu -if ! which dconf > /dev/null +if ! command -v dconf > /dev/null then echo "Can't find dconf, exiting." exit 0 diff --git a/Documents/bin/gen-bash-completion b/Documents/bin/gen-bash-completion index 9faa24a0e31026d2840c5a68a63b12ecbbe8d5ff..85ad36408b961a1508f0d396d4b09553a50c2a7e 100755 --- a/Documents/bin/gen-bash-completion +++ b/Documents/bin/gen-bash-completion @@ -1,5 +1,5 @@ #!/bin/sh set -eu -! which pandoc > /dev/null || pandoc --bash-completion > "$HOME/.bash_completion.d/pandoc" -! which pipenv > /dev/null || pipenv --completion > "$HOME/.bash_completion.d/pipenv" +! command -v pandoc > /dev/null || pandoc --bash-completion > "$HOME/.bash_completion.d/pandoc" +! command -v pipenv > /dev/null || pipenv --completion > "$HOME/.bash_completion.d/pipenv" diff --git a/Documents/bin/git-update-requirements b/Documents/bin/git-update-requirements index d4f57ec9a8c77c3fbf86e9cc60f8f4c67ece710f..03375c4fa606d5d76f09ca4862b8c465a6b2601f 100755 --- a/Documents/bin/git-update-requirements +++ b/Documents/bin/git-update-requirements @@ -1,6 +1,6 @@ #!/bin/sh set -eu -which pur > /dev/null || { echo "Can't find pur."; exit 1; } +command -v pur > /dev/null || { echo "Can't find pur."; exit 1; } git stash save --all --include-untracked --quiet git ls-files '*requirements*.txt' | xargs -n1 pur -r diff --git a/Documents/bin/wifi-login b/Documents/bin/wifi-login index 765339463a87c05087eceb47b940222e382a37b6..76328a57be0f92dfd351490f7b5a06b05f40e2f5 100755 --- a/Documents/bin/wifi-login +++ b/Documents/bin/wifi-login @@ -60,10 +60,10 @@ else action="$2" fi -which curl > /dev/null || die "Can't login to the WiFi network, cURL is not installed." -which awk > /dev/null || die "Can't login to the WiFi network, awk is not installed." -which logger > /dev/null || die "Can't login to the WiFi network, logger is not installed." -which nmcli > /dev/null || die "Can't login to the WiFi network, nmcli is not installed." +command -v curl > /dev/null || die "Can't login to the WiFi network, cURL is not installed." +command -v awk > /dev/null || die "Can't login to the WiFi network, awk is not installed." +command -v logger > /dev/null || die "Can't login to the WiFi network, logger is not installed." +command -v nmcli > /dev/null || die "Can't login to the WiFi network, nmcli is not installed." echo "$action" | grep -xq 'up\|dhcp4-change\|dhcp6-change\|connectivity-change' || \ die "Can't login to the WiFi network, action $action isn't up nor changed." diff --git a/Documents/bin/wrapper b/Documents/bin/wrapper index 1b8af530d06fd65ed18af69b3b400a1dc26e4fe5..a51cd36ad5580607447591d28581a5f5e724f0dd 100755 --- a/Documents/bin/wrapper +++ b/Documents/bin/wrapper @@ -2,8 +2,8 @@ set -eu basename="$(basename "$0")" -command="$(env -i which "$basename")" || { echo "$basename: not found"; exit 127; } -if alias="$(which "$basename-${1:-}")" +command="$(env -i sh -c "command -v $basename")" || { echo "$basename: not found"; exit 127; } +if alias="$(command -v "$basename-${1:-}")" then shift "$alias" "$@"