Remove useless -q option in ls command

This commit adds support to minimal distros or unsupported distros such as Alpine Linux (uses busybox) by preventing the error which says '-q' option isn't supported. Also, '-q' option in ls command isn't actually required because what '-q' option does is just prints '?' character instead of nongraphic characters. (Prevent error being shown)

## References

- https://linuxcommand.org/lc3_man_pages/ls1.html

       -q, --hide-control-chars
              print ? instead of nongraphic characters
This commit is contained in:
Seia-Soto 2020-11-10 05:45:22 +09:00 committed by GitHub
parent 11a9d22607
commit 83d7db0851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
nvm.sh
View File

@ -1121,13 +1121,13 @@ nvm_ls() {
fi
fi
if ! [ -d "${NVM_DIRS_TO_SEARCH1}" ] || ! (command ls -1qA "${NVM_DIRS_TO_SEARCH1}" | nvm_grep -q .); then
if ! [ -d "${NVM_DIRS_TO_SEARCH1}" ] || ! (command ls -1A "${NVM_DIRS_TO_SEARCH1}" | nvm_grep -q .); then
NVM_DIRS_TO_SEARCH1=''
fi
if ! [ -d "${NVM_DIRS_TO_SEARCH2}" ] || ! (command ls -1qA "${NVM_DIRS_TO_SEARCH2}" | nvm_grep -q .); then
if ! [ -d "${NVM_DIRS_TO_SEARCH2}" ] || ! (command ls -1A "${NVM_DIRS_TO_SEARCH2}" | nvm_grep -q .); then
NVM_DIRS_TO_SEARCH2="${NVM_DIRS_TO_SEARCH1}"
fi
if ! [ -d "${NVM_DIRS_TO_SEARCH3}" ] || ! (command ls -1qA "${NVM_DIRS_TO_SEARCH3}" | nvm_grep -q .); then
if ! [ -d "${NVM_DIRS_TO_SEARCH3}" ] || ! (command ls -1A "${NVM_DIRS_TO_SEARCH3}" | nvm_grep -q .); then
NVM_DIRS_TO_SEARCH3="${NVM_DIRS_TO_SEARCH2}"
fi