Sponsored Content
Full Discussion: at reminder script
Homework and Emergencies Homework & Coursework Questions at reminder script Post 302564351 by csharp100 on Thursday 13th of October 2011 11:35:23 AM
Old 10-13-2011
Ok everyone, I am back. My problem this time is the elm -s in the 2nd if loop is not working. I cannot get it to mail the message to me when I am offline. Here is my code:
Code:
# Alertme.p1 program, version 0.7
# Author - Clint Sharp
# This program is interactive and will alert the user
# if they are online at more than one terminal. It will also mail the
# user at the mail address associated with the user id.
mkdir ~/Msgs
echo "\nEnter your reminder message.
When finished, enter a period (.) at
the beginning of a line and press <ENTER>.
(Or press Ctrl-C to exit the script)\n"
while :
do
        read MESSAGE
        if [ "$MESSAGE" = "." ]
        then
                break
        else
                echo $MESSAGE >> ~/Msgs/message.$$
        fi
done
echo "\nEnter the time and day you want to
receive the message, for example:
0815am Jun 14
8:15am Jun 14
now + 1 day
5 pm Friday
8:15am 6/14/2011
Then press <ENTER>\n"
read TIME 
echo "\nAt $TIME mail or write $LOGNAME ~/Msgs/message.$$\n"
at -k $TIME << EOF
if [ `who | grep -c "$LOGNAME"` -gt 0 ]; then
who | cut -c1-20 | grep $LOGNAME | cut -c12-20 > ~/tmp
while read inputline
do
        write $LOGNAME \$inputline < ~/Msgs/message.$$ > /dev/null 2>&1
done < ~/tmp
exit
fi
if [ `who | grep -c "$LOGNAME"` -eq 0 ]; then
elm -s $LOGNAME < ~/Msgs/message.$$
exit
fi
rm -r ~/Msgs
rm -r ~/tmp
exit 0
EOF

Can anyone see what might be the problem? I appreciate all the help here. I will clean up this script with sed and awk on the next assignment. We are in the process of learning both now.
 

2 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Reminder script not working...

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: We have been tasked to write an at reminder script that will write or echo a message to more than one user. What... (11 Replies)
Discussion started by: csharp100
11 Replies

2. OS X (Apple)

A simple reminder script for beginners to shell scripting.

(Apologies for any typos.) Well hands up those who have been in the following situation(s):- Your partner, (in my case the missus), sees that you are messing with your machine and says something like, "can you keep an eye on the dinner, I am going out shopping", and you look up glazed eyed... (3 Replies)
Discussion started by: wisecracker
3 Replies
DROP TEXT SEARCH 
TEMPLATE(7) SQL Commands DROP TEXT SEARCH TEMPLATE(7) NAME
DROP TEXT SEARCH TEMPLATE - remove a text search template SYNOPSIS
DROP TEXT SEARCH TEMPLATE [ IF EXISTS ] name [ CASCADE | RESTRICT ] DESCRIPTION
DROP TEXT SEARCH TEMPLATE drops an existing text search template. You must be a superuser to use this command. PARAMETERS
IF EXISTS Do not throw an error if the text search template does not exist. A notice is issued in this case. name The name (optionally schema-qualified) of an existing text search template. CASCADE Automatically drop objects that depend on the text search template. RESTRICT Refuse to drop the text search template if any objects depend on it. This is the default. EXAMPLES
Remove the text search template thesaurus: DROP TEXT SEARCH TEMPLATE thesaurus; This command will not succeed if there are any existing text search dictionaries that use the template. Add CASCADE to drop such dictionar- ies along with the template. COMPATIBILITY
There is no DROP TEXT SEARCH TEMPLATE statement in the SQL standard. SEE ALSO
ALTER TEXT SEARCH TEMPLATE [alter_text_search_template(7)], CREATE TEXT SEARCH TEMPLATE [create_text_search_template(7)] SQL - Language Statements 2010-05-14 DROP TEXT SEARCH TEMPLATE(7)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy