Skip to content

Instantly share code, notes, and snippets.

@chaos-zhu
Last active June 9, 2022 02:21
Show Gist options
  • Save chaos-zhu/5c7e845d7b6363a5986d89cb95682182 to your computer and use it in GitHub Desktop.
Save chaos-zhu/5c7e845d7b6363a5986d89cb95682182 to your computer and use it in GitHub Desktop.

Revisions

  1. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,13 @@ cdroot () {

    cdroot

    rm install-nodejs.sh

    if [ $? == "0" ] ; then
    echo '删除旧脚本'
    exit 1
    fi

    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

    if [ $? != "0" ] ; then
    @@ -23,4 +30,7 @@ fi

    cdroot

    source /root/nvm.sh
    source /root/.nvm/nvm.sh

    echo "$(nvm -v)"

  2. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 0 additions and 7 deletions.
    7 changes: 0 additions & 7 deletions install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -14,13 +14,6 @@ cdroot () {

    cdroot

    rm install-nodejs.sh

    if [ $? == "0" ] ; then
    echo '删除旧脚本'
    exit 1
    fi

    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

    if [ $? != "0" ] ; then
  3. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -30,4 +30,4 @@ fi

    cdroot

    source nvm.sh
    source /root/nvm.sh
  4. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,11 @@ fi
    # 编写中...
    echo '开始安装nvm'

    alias root="cd /root"
    cdroot () {
    cd /root
    }

    root
    cdroot

    rm install-nodejs.sh

    @@ -26,6 +28,6 @@ if [ $? != "0" ] ; then
    exit 1
    fi

    root
    cdroot

    source nvm.sh
  5. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 11 additions and 2 deletions.
    13 changes: 11 additions & 2 deletions install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,16 @@ fi
    # 编写中...
    echo '开始安装nvm'

    cd ~
    alias root="cd /root"

    root

    rm install-nodejs.sh

    if [ $? == "0" ] ; then
    echo '删除旧脚本'
    exit 1
    fi

    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

    @@ -17,6 +26,6 @@ if [ $? != "0" ] ; then
    exit 1
    fi

    cd ~/.nvm || exit
    root

    source nvm.sh
  6. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ echo '开始安装nvm'

    cd ~

    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh123 | bash
    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

    if [ $? != "0" ] ; then
    echo '下载nvm失败'
  7. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,9 @@ fi

    # 编写中...
    echo '开始安装nvm'

    cd ~

    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh123 | bash

    if [ $? != "0" ] ; then
  8. chaos-zhu revised this gist Jun 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ fi
    echo '开始安装nvm'
    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh123 | bash

    if [ "$($?)" != "0" ] ; then
    if [ $? != "0" ] ; then
    echo '下载nvm失败'
    exit 1
    fi
  9. chaos-zhu created this gist Jun 9, 2022.
    19 changes: 19 additions & 0 deletions install-nodejs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/bash

    if [ "$(id -u)" != "0" ] ; then
    echo "***********************需root权限***********************"
    exit 1
    fi

    # 编写中...
    echo '开始安装nvm'
    wget -qO- https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh123 | bash

    if [ "$($?)" != "0" ] ; then
    echo '下载nvm失败'
    exit 1
    fi

    cd ~/.nvm || exit

    source nvm.sh