
我有一個 bash 腳本,內容如下:
long_command --some --arguments
long_command_2 --other --arguments
...
echo -e "\nSet up next step, then press enter to continue..."
read -p ""
another_long_command --some --arguments
我期望讀取命令上的一個“Enter”鍵將立即啟動以下命令。但是,我注意到在執行下一個命令之前,我已經多次點擊「Enter」(大約 10 次左右)。
我想知道會發生什麼事?難道是stdin
被老指揮吃掉了?發生了一些奇怪的緩衝行為?
先致謝!