Skip to content

Commit 9f74d39

Browse files
JanSchnackiRendanic
authored andcommitted
Fix which command lookups
When which is an alias or a function, usage of which was broken
1 parent 7e02fdc commit 9f74d39

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ocenv

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ set_sql_path_vars() {
400400
set_sql_path_vars
401401

402402
## Configure syntax highlighting in VIM, but only if not configured already
403-
if [[ -n "$(which vim 2>/dev/null)" && -f "$(which vim)" ]]
403+
if [[ -n "$(command which vim 2>/dev/null)" && -f "$(command which vim)" ]]
404404
then
405405
export EDITOR=vim
406406
alias vi=vim
@@ -460,9 +460,9 @@ fi
460460

461461
if [[ -z "${GV_RLWRAP}" || ! -x "${GV_RLWRAP}" ]]
462462
then
463-
if [[ -x "$(which rlwrap 2>/dev/null)" ]]
463+
if [[ -x "$(command which rlwrap 2>/dev/null)" ]]
464464
then
465-
GV_RLWRAP="$(which rlwrap 2>/dev/null)"
465+
GV_RLWRAP="$(command which rlwrap 2>/dev/null)"
466466
elif [[ "${GV_OS_TYPE}" == 'Linux' ]]
467467
then
468468
# Look for "custom" rlwrap binaries in $HOME of current user
@@ -568,7 +568,7 @@ then
568568
echo "@${GV_CUSTOM_LOGIN_SQL}" >> "${GV_SQL_DIR}/login.sql"
569569
fi
570570

571-
GV_LS_CMD="$(which ls)"
571+
GV_LS_CMD="$(command which ls)"
572572
alias cdh='cd ${ORACLE_HOME}'
573573
unalias cdt 2>/dev/null
574574
# shellcheck disable=2164
@@ -579,14 +579,14 @@ alias cda='if [[ -d "${ORACLE_BASE}/admin/${ORACLE_SID}" ]]; then cd "${ORACLE_B
579579
alias cdd='cd ${GV_INSTANCE_DIAGNOSTIC_DEST}/trace'
580580
alias pmon='ps -ef | grep -w -E "ora_pmon_[a-zA-Z0-9]+"'
581581
## amon uses ASH if not called with "-l n" parameter
582-
[[ -n "$(which amon 2>/dev/null)" ]] && alias amon="\$(which amon) -l n"
582+
[[ -n "$(command which amon 2>/dev/null)" ]] && alias amon="\$(command which amon) -l n"
583583
if [[ "${GV_OS_TYPE}" == "AIX" ]]
584584
then
585585
alias psg='ps -ef | grep -v grep | grep '
586586
else
587587
alias psg='ps aux | grep -v grep | grep --color=auto'
588588
fi
589-
if [[ -x "$(which less 2>/dev/null)" ]]
589+
if [[ -x "$(command which less 2>/dev/null)" ]]
590590
then
591591
export GV_PAGER=less
592592
else
@@ -1386,7 +1386,7 @@ edf() {
13861386
local LV_THRESHOLD_CRIT=95
13871387
local LV_THRESHOLD_WARN=85
13881388

1389-
if [[ "$(uname -s)" == "AIX" ]] && ! (which df 2>/dev/null| grep -q "/opt/freeware/")
1389+
if [[ "$(uname -s)" == "AIX" ]] && ! (command which df 2>/dev/null| grep -q "/opt/freeware/")
13901390
then
13911391
local LV_DF="df -Pg"
13921392
else
@@ -2338,7 +2338,7 @@ list_homes() {
23382338
}
23392339
mystat() {
23402340
local LV_TARGET="${1}"
2341-
if [[ "$(uname -s)" == "AIX" ]] && ! (which stat 2>/dev/null| grep -q "/opt/freeware/")
2341+
if [[ "$(uname -s)" == "AIX" ]] && ! (command which stat 2>/dev/null| grep -q "/opt/freeware/")
23422342
then
23432343
istat "${LV_TARGET}" | awk '/Owner/{split($2, v_a, "[()]"); print v_a[2]; }'
23442344
else

0 commit comments

Comments
 (0)