我正在编写一个脚本,该脚本将首先检查当前是否已安装Node,否则将安装最新版本的Node。如果已安装,则它将继续执行另一个功能以对其进行更新。
我当前的脚本:
#!/bin/bash
function isNodeInstalled() {
clear
echo "Checking if Node is installed ..."
if command --version node &>/dev/null; then
echo "Installing Node ..."
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install nodejs -y
echo "Node has been installed."
sleep 5
updateNode
else
echo "Node has already been installed."
sleep 5
updateNode
fi
}
if which node > /dev/null
then
echo "node is installed, skipping..."
else
# add deb.nodesource repo commands
# install node
fi
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句