我有以下 bash 脚本:
# do some time consuming task here read -p "Give me some input: " input
现在您可能已经猜到了,如果用户在“耗时任务”期间按了一些随机键,那么不需要的输入也会被考虑在内。stdin在发出读取命令之前如何清除(或至少忽略它)?
stdin
linux bash shell stdin
bash ×1
linux ×1
shell ×1
stdin ×1