#!/bin/bash
# t-out.sh
# "syngin seven"........ (thanks).
TIMELIMIT=4 # 4 seconds
read -t $TIMELIMIT variable <&1
# ^^^
# ......,..Bash 1.x.2.x....."<&1"
# ...Bash 3.x.....
echo
if [ -z "$variable" ] # Is null?
then
echo "Timed out, variable still unset."
else
echo "variable = $variable"
fi
exit 0
阅读(966) | 评论(0) | 转发(0) |