Debian Codegraph @

t-out.sh

raw symbols SCIP
1 #!/bin/bash
2 # t-out.sh [time-out]
3 # Inspired by a suggestion from "syngin seven" (thanks).
4
5
6 TIMELIMIT=4 # 4 seconds
7
8 read -t $TIMELIMIT variable <&1
9 # ^^^
10 # In this instance, "<&1" is needed for Bash 1.x and 2.x,
11 # but unnecessary for Bash 3+.
12
13 echo
14
15 if [ -z "$variable" ] # Is null?
16 then
17 echo "Timed out, variable still unset."
18 else
19 echo "variable = $variable"
20 fi
21
22 exit 0