[Robustness] avoid a clobbered `ls`

Fixes #2824
Jordan Harband 2022-06-02 12:25:55 -07:00
parent ef3b20c21e
commit a82edf40ba
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 1 additions and 1 deletions

2
nvm.sh
View File

@ -1880,7 +1880,7 @@ nvm_get_arch() {
# change ARCH to 32bit ARM (armv7l) if /sbin/init is 32bit executable
local L
if [ "$(uname)" = "Linux" ] && [ "${NVM_ARCH}" = arm64 ] &&
L="$(ls -dl /sbin/init 2>/dev/null)" &&
L="$(command ls -dl /sbin/init 2>/dev/null)" &&
[ "$(od -An -t x1 -j 4 -N 1 "${L#*-> }")" = ' 01' ]; then
NVM_ARCH=armv7l
HOST_ARCH=armv7l