使用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