Can you write a simple weekly reminder with bash / sh script quine?

I need to set myself a reminder to attend a weekly meeting. The problem with my standard reminder tool is that when it works under wine, it appears on the on-screen virtual desktop.

I thought it would be interesting to see if I could come up with an “at” command that would pop up a reminder window and then re-introduce myself next week.

I know that I can use cron or some kind of application for an alarm clock, but it aroused my curiosity.

Single shot version:

echo "DISPLAY=$DISPLAY zenity --title='Weekly Meeting' --text='Time for the weekly meeting' --info" | at 0955 NEXT Monday 

Can someone come up with a suitable quine- like command, which at each start will additionally resend the same one, execute the next week in a repeating cycle?

+4
source share
4 answers

Try:

 export reminder='"DISPLAY=$DISPLAY zenity --title='\''Weekly Meeting'\'' --text='\''Time for the weekly meeting'\'' --info" | at 0955 NEXT Monday'; echo $reminder | at 0955 NEXT Monday 

Change both at commands to say at now + 1 minute for testing. $DISPLAY will be set when the command is entered and may be incorrect during the execution of the task, but this is the same behavior as the command in your question.

+1
source

Try with the file:

 $ cat /tmp/quine_file DISPLAY=:0.0 zenity --title='Weekly Meeting' --text='Time for the weekly meeting' --info; at '0955 NEXT monday' </tmp/quine_file; $ at '0955 NEXT monday' </tmp/quine_file 

Thus, each time the task is completed, another is scheduled for next Monday.

0
source

I'm probably cheating, but you can take advantage of the fact that at saves the value of most environment variables (not $DISPLAY though, nor $DISP seems):

 export FOO=$DISPLAY CMD='DISPLAY=$FOO xmessage "hi there"; echo "$CMD" | at now + 1 minutes' eval "$CMD" 

I used xmessage and one minute because I had them, but of course you can adapt it to your needs.

0
source

Sorry to spoil the fun, but ... would some cron job make more sense?

0
source

All Articles