【发布时间】:2013-08-20 23:04:24
【问题描述】:
#!/bin/bash
echo -n "Hurry up and type something! > "
if read -t 10 response ; then
echo "Greate, you made it in time!"
else
echo "sorry, you are too slow!"
fi
我在终端中写了上面的代码,得到了错误“read: Illegal option -t”。
【问题讨论】:
-
我没有收到任何错误。与
GNU bash, Version 4.2.37(1)-release (x86_64-pc-linux-gnu)一起工作正常 -
我在 ubuntu 12.10 32-bit pc 中遇到了这个错误
-
检查您使用的 bash 版本:
echo $BASH_VERSION