Skip to content

Commit 31e1087

Browse files
committed
refactor: use bash builtin type -P instead of which command 🐚
1 parent a982202 commit 31e1087

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bin/c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ done
102102

103103
readonly keep_eol quiet target_command
104104

105-
if ((${#target_command[@]} > 0)) && ! which "${target_command[0]}" &>/dev/null; then
105+
if ((${#target_command[@]} > 0)) && ! type -P "${target_command[0]}" &>/dev/null; then
106106
die "command '${target_command[0]}' not found on PATH"
107107
fi
108108

bin/cp-into-docker-run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ command -v docker &>/dev/null || die 'docker command not found!'
180180
readonly specified_run_command=${args[0]}
181181
run_command=$specified_run_command
182182
if [ ! -f "$specified_run_command" ]; then
183-
which "$specified_run_command" &>/dev/null ||
183+
type -P "$specified_run_command" &>/dev/null ||
184184
die "specified command not exists and not found in PATH: $specified_run_command"
185185

186-
run_command=$(which "$specified_run_command")
186+
run_command=$(type -P "$specified_run_command")
187187
fi
188188

189189
run_command=$(realpath "$run_command")

0 commit comments

Comments
 (0)