Re: at based alarm.
- Date: Tue, 13 Feb 2018 13:02:32 -0500
- From: Greg Wooledge <wooledg@xxxxxxxxxxx>
- Subject: Re: at based alarm.
On Tue, Feb 13, 2018 at 08:47:56AM -0800, peter@xxxxxxxxxxx wrote:
> peter@computer:~$ cat wake
> until [[ $input != "" ]] ; do
> echo Beginning until loop.
> /usr/bin/play /home/peter/ring.wav
> read -n 1 -t 4 input
> Test the script.
> peter@computer:~$ xterm -e ./wake
> Yes, it works for bash. Appears [[ or read is not available in dash.
The [[ command is a bashism, yes.
The read command is not a bashism, but read -t and read -n *are*.
The only portable option for read is -r.
Since you're relying heavily on the read-with-timeout, just stick
with bash and do not even ATTEMPT it in sh.