Combine sed and grep commands
parent
70370a857f
commit
394e8505d9
21
nvm.sh
21
nvm.sh
|
@ -603,17 +603,20 @@ nvm_ls() {
|
||||||
fi
|
fi
|
||||||
if [ -n "$NVM_DIRS_TO_SEARCH" ]; then
|
if [ -n "$NVM_DIRS_TO_SEARCH" ]; then
|
||||||
VERSIONS="$(command find $NVM_DIRS_TO_SEARCH -maxdepth 1 -type d -name "$PATTERN*" \
|
VERSIONS="$(command find $NVM_DIRS_TO_SEARCH -maxdepth 1 -type d -name "$PATTERN*" \
|
||||||
| command sed "s#$NVM_VERSION_DIR_IOJS/#"$NVM_IOJS_PREFIX"-#" \
|
| command sed "
|
||||||
| command grep -v "$NVM_VERSION_DIR_IOJS" \
|
s#$NVM_VERSION_DIR_IOJS/#$NVM_IOJS_PREFIX-#;
|
||||||
| command sed "s#^$NVM_DIR/##" \
|
\#$NVM_VERSION_DIR_IOJS# d;
|
||||||
| command grep -v -e '^versions$' \
|
s#^$NVM_DIR/##;
|
||||||
| command sed 's#^versions/##' \
|
\#^versions\$# d;
|
||||||
| sed -e "s/^v/$NVM_NODE_PREFIX-v/" \
|
s#^versions/##;
|
||||||
| sed -e "s#^\($NVM_IOJS_PREFIX\)[-/]v#\1.v#" | sed -e "s#^\($NVM_NODE_PREFIX\)[-/]v#\1.v#" \
|
s#^v#$NVM_NODE_PREFIX-v#;
|
||||||
|
s#^\($NVM_IOJS_PREFIX\)[-/]v#\1.v#;
|
||||||
|
s#^\($NVM_NODE_PREFIX\)[-/]v#\1.v#" \
|
||||||
| command sort -t. -u -k 2.2,2n -k 3,3n -k 4,4n \
|
| command sort -t. -u -k 2.2,2n -k 3,3n -k 4,4n \
|
||||||
| command sort -s -t- -k1.1,1.1 \
|
| command sort -s -t- -k1.1,1.1 \
|
||||||
| command sed "s/^\($NVM_IOJS_PREFIX\)\./\1-/" \
|
| command sed "
|
||||||
| command sed "s/^$NVM_NODE_PREFIX\.//")"
|
s/^\($NVM_IOJS_PREFIX\)\./\1-/;
|
||||||
|
s/^$NVM_NODE_PREFIX\.//")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then
|
if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then
|
||||||
|
|
Loading…
Reference in New Issue