[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: at based alarm.



On Tue, Feb 13, 2018 at 08:47:56AM -0800, peter@easthope.ca wrote:
> peter@computer:~$ cat wake
> #!/bin/bash
>   input=""
>   until [[ $input != "" ]] ; do
>     echo Beginning until loop.
>     /usr/bin/play /home/peter/ring.wav
>     read -n 1 -t 4 input
>   done
> 
> 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.


Reply to: