为什么在使用curl获取bash脚本时无法读取-p?

时间:2018-08-22 10:15:46

标签: bash curl

我使用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来运行它,它将为我提供: enter image description here

0 个答案:

没有答案