I am having a problem writing a script for 'zenity.' My intention is to have a comment selected randomly from a list and then displayed on the screen for the user to see. To be honest, I would like to have the program run its self automatically every two hours or so, but I don't have a clue how to make that happen. I am new to bash scripting and am simply trying to teach it to myself through Google searches, the bash scripting guide, and trial and error. This program will, in the end, generate a random stupid remark every couple of hours; purely for comic relief.
#! /bin/bash #Create a random number between 0 and 3 RANGE=4 number=$RANDOM let "number %= $RANGE" echo $number #Set random number generated above to select from list of comments. if ($number == 0); then COMMENT=Comment0 elif ($number == 1); then COMMENT=Comment1 elif ($number == 2); then COMMENT=Comment2 elif ($number == 3); then COMMENT=Comment3 echo $COMMENT zenity --warning --title='!!!WARNING!!!' text=$COMMENT
Anyway, I am having a lot of trouble with the 'if' statements. From what I have learned so far, it looks right to me; but I get nothing but errors despite many attempted edits. I would sure like some help from anyone interested.