Skip to content

Commit e797a66

Browse files
committed
use a $TAIL_PATH env for 'tail' command
The command 'tail' was aliased to 'colortail' in my local environment and 'colortail' was not installed locally, so it failed during setting up the 'cd' and '__gvm_oldcd' functions. This caused the 'cd' command to silently do nothing and never change directories.
1 parent dd65253 commit e797a66

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

scripts/env/cd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
if __gvm_is_function __gvm_oldcd; then
1313
# output from declare -f on zsh omits a newline before opening brace, so
1414
# we need to add the newline for consistency with bash.
15-
eval "$(echo "cd()"; declare -f __gvm_oldcd | sed '1 s/{/\'$'\n''{/' | tail -n +2)"
15+
eval "$(echo "cd()"; declare -f __gvm_oldcd | sed '1 s/{/\'$'\n''{/' | $TAIL_PATH -n +2)"
1616
unset -f __gvm_oldcd
1717
fi
1818

1919
if __gvm_is_function cd; then
20-
eval "$(echo "__gvm_oldcd()"; declare -f cd | sed '1 s/{/\'$'\n''{/' | tail -n +2)"
20+
eval "$(echo "__gvm_oldcd()"; declare -f cd | sed '1 s/{/\'$'\n''{/' | $TAIL_PATH -n +2)"
2121
elif [[ "$(builtin type cd)" == "cd is a shell builtin" ]]; then
2222
eval "$(echo "__gvm_oldcd() { builtin cd \$*; return \$?; }")"
2323
fi

scripts/function/tools

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ GREP_ERROR="GVM couldn't find grep"
66
EGREP_ERROR="GVM couldn't find egrep"
77
SORT_ERROR="GVM couldn't find sort"
88
HEAD_ERROR="GVM couldn't find head"
9+
TAIL_ERROR="GVM couldn't find tail"
910
HEXDUMP_ERROR="GVM couldn't find hexdump"
1011

1112
LS_PATH=$(unalias ls &> /dev/null; command -v ls) || display_error "$LS_ERROR" || return 1
@@ -15,4 +16,5 @@ GREP_PATH=$(unalias grep &> /dev/null; command -v grep) || display_error "$GREP_
1516
EGREP_PATH=$(unalias egrep &> /dev/null; command -v egrep) || display_error "$EGREP_ERROR" || return 1
1617
SORT_PATH=$(unalias sort &> /dev/null; command -v sort) || display_error "$SORT_ERROR" || return 1
1718
HEAD_PATH=$(unalias head &> /dev/null; command -v head) || display_error "$HEAD_ERROR" || return 1
19+
TAIL_PATH=$(unalias tail &> /dev/null; command -v tail) || display_error "$TAIL_ERROR" || return 1
1820
HEXDUMP_PATH=$(unalias hexdump &> /dev/null; command -v hexdump) || display_error "$HEXDUMP_ERROR" || return 1

0 commit comments

Comments
 (0)