使用bash脚本的这一部分作为一个例子如何在不必按ENTER的情况下输入'y'?
{
read -p "Do you want to update the tv feed? [y/n/q] " ynq
case $ynq in
[Yy]*) rm ~/cron/beeb.txt; /usr/bin/get-iplayer --type tv>>~/cron/beeb.txt;;
[Nn]*) echo;;
[Qq]*) exit;;
*) echo "Please answer yes or no. ";;
esac
}
我如何得到它,这样就可以按Ÿ,而不必按输入它被接受吗?
您可以使用'-n'指定要读取的字符数。搜索btw时的第一个结果。 – keyser