From dcba8b40643098776d652a037085cb1d0801aa52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 5 May 2021 22:42:56 +0200 Subject: [PATCH] Supply `head -n` flag explicitly The syntax `head -NUM` was deprecated in the POSIX standard. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html --- libexec/rbenv | 2 +- libexec/rbenv-help | 2 +- libexec/rbenv-hooks | 2 +- libexec/rbenv-versions | 2 +- test/exec.bats | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rbenv b/libexec/rbenv index 070c441c..2e454969 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -29,7 +29,7 @@ if enable -f "${BASH_SOURCE%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev else [ -z "$RBENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin" - READLINK=$(type -p greadlink readlink 2>/dev/null | head -1) + READLINK=$(type -p greadlink readlink 2>/dev/null | head -n1) [ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" resolve_link() { diff --git a/libexec/rbenv-help b/libexec/rbenv-help index 5b3af232..fefbaab4 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -43,7 +43,7 @@ extract_initial_comment_block() { collect_documentation() { local awk - awk="$(type -p gawk awk 2>/dev/null | head -1)" + awk="$(type -p gawk awk 2>/dev/null | head -n1)" if [ -z "$awk" ]; then echo "rbenv: cannot find awk" >&2 return 1 diff --git a/libexec/rbenv-hooks b/libexec/rbenv-hooks index 64334cc7..2fa48e24 100755 --- a/libexec/rbenv-hooks +++ b/libexec/rbenv-hooks @@ -26,7 +26,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/rbenv-realpath.dylib realpath 2>/dev/null; th echo "rbenv: failed to load \`realpath' builtin" >&2 exit 1 fi -READLINK=$(type -p greadlink readlink 2>/dev/null | head -1) +READLINK=$(type -p greadlink readlink 2>/dev/null | head -n1) if [ -z "$READLINK" ]; then echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 exit 1 diff --git a/libexec/rbenv-versions b/libexec/rbenv-versions index 21a9bdf2..d20b4556 100755 --- a/libexec/rbenv-versions +++ b/libexec/rbenv-versions @@ -33,7 +33,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/rbenv-realpath.dylib realpath 2>/dev/null; th exit 1 fi - READLINK=$(type -p greadlink readlink 2>/dev/null | head -1) + READLINK=$(type -p greadlink readlink 2>/dev/null | head -n1) if [ -z "$READLINK" ]; then echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2 exit 1 diff --git a/test/exec.bats b/test/exec.bats index 5413912b..1ee74357 100644 --- a/test/exec.bats +++ b/test/exec.bats @@ -87,7 +87,7 @@ OUT if [[ \$1 == "-S"* ]]; then found="\$(PATH="\${RUBYPATH:-\$PATH}" which \$2)" # assert that the found executable has ruby for shebang - if head -1 "\$found" | grep ruby >/dev/null; then + if head -n1 "\$found" | grep ruby >/dev/null; then \$BASH "\$found" else echo "ruby: no Ruby script found in input (LoadError)" >&2