我使用curl https://carry0987.github.io/repo/ | sudo bash
使用read -p
运行脚本,但是根本不起作用
它不会等待用户键入值。
这是我的剧本:
#!/bin/bash
set -e
echo '1) Install Main Pkg'
echo '2) Tools'
echo '3) Rclone Mount'
echo '4) Delete Rclone Mount'
read -p 'Which tool do you want to use ? ' tool
link1=https://raw.github.com/carry0987/Raspberry-Pi-Repo/master/Setup/Install-Main-Pkg.sh
link2=https://raw.github.com/carry0987/Raspberry-Pi-Repo/master/Tools/tools.sh
link3=https://raw.github.com/carry0987/Raspberry-Pi-Repo/master/Rclone-Mount/rclone-mount.sh
link4=https://raw.github.com/carry0987/Raspberry-Pi-Repo/master/Rclone-Mount/delete-rclone-mount.sh
#Detect tools
case $tool in
1)
wget $link1 -O `basename $link1`
;;
2)
wget $link2 -O `basename $link2`
;;
3)
wget $link3 -O `basename $link3`
;;
4)
wget $link4 -O `basename $link4`
;;
*)
echo 'Tools not supported'
;;
esac
exit 0
如果我使用curl https://carry0987.github.io/repo/ | sudo bash
来运行它,它将为我提供: