How to do it...

  1. We are going to use the logger command to enter file_name into the syslog file. Run the following command:
$ logger -f file_name
  1. Now we are going to write a script to create an alarm. Create a create_alarm.sh script and write the following code in it:
#!/bin/bashdeclare -i Hdeclare -i Mdeclare -i cur_Hdeclare -i cur_Mdeclare -i min_leftdeclare -i hour_leftecho -e "What time do you Wake Up?"read Hecho -e "and Minutes?"read  Mcur_H=`date +%H`cur_M=`date +%M`echo "You Selected "echo "$H:$M"echo -e "\nIt is Currently $cur_H:$cur_M"if [  $cur_H -lt $H ]; then    hour_left=`expr $H - $cur_H`    echo "$H - $cur_H means You Have: $hour_left hours still"fiif [ $cur_H -gt $H ]; then    hour_left=`expr $cur_H - $H` echo -e "\n$cur_H - $H ...

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.