Re: at based alarm.
From: davidson <davidson@freevolt.org>
Date: Sun, 11 Feb 2018 10:31:25 +0000 (UTC)
> In the "wake" script, you could start xterm with the -e option (and
> put the remainder of your "wake" script in a separate "wake-aux"
> script, I guess):
OK, thanks. wake is now simplified to this.
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.
Also tried defining a function in .bashrc.
peter@computer:~$ declare -f wake
wake ()
{
input=""
until [[ $input != "" ]] ; do
echo Beginning until loop.;
/usr/bin/play /home/peter/ring.wav;
read -n 1 -t 4 input;
done
}
Test the function.
peter@computer:~$ wake
Yes, it works .
Test the function with xterm.
peter@computer:~$ xterm -e wake
The xterm window opens and immediately closes. A function
is not an acceptable option?
Try the alarm using the working script.
peter@computer:~$ echo "xterm -display :0 -e ./wake" | at 6:30
The xterm window doesn't open but there is no error message
to the originating terminal or to syslog.
I need to understand why "xterm -display :0 -e ./wake" fails for at
but works interactively.
> I ask about your intent above because this next line...
>
> until [[ $input != "" ]] ; do
>
> ...employs the new-fangled Korn shell/Bash conditional test '[[',
> instead of the old-fangled test builtin '['.
bash is now specified. I'd prefer "test" rather than "[[" but haven't
found how to make it work. In common use, "[" and "[[" are delimiters.
"test" is a better keyword.
Thanks, ... P.
--
123456789 123456789 123456789 123456789 123456789 123456789 123456789
Tel: +1 360 639 0202 Pender Is.: +1 250 629 3757
http://easthope.ca/Peter.html Bcc: peter at easthope. ca
Reply to: