Ok, so I got the last problem straightened out and now I have another. It seems I am so close yet so far away. Here is my code;
What is happening is I will have two terminal sessions opened to test this script and it is sending two messages to the same terminal. The one that originally initiated the script. I also get a mail message that says,
On the terminal pts/98 I did change message to "yes" using the -y switch. I do not think this is the problem though. Can anyone help?
"$" variables are likely being substituted before the script is run, so $inputline never changes. You have to escape it with \.
This !! business is strange as well. On my system, that tells it to end the here document on 'man write', since that's the command I ran last.
That's a useless use of cat, by the way. Any command can be redirected to file, not just cat -- so leave off the cat and send your last cut into a file, cut -c12-20 > ~/tmp
That's also a useless use of a temp file. You can just feed cut's output directly into the while loop with no intervening file: a | b | c | while read LINE ; do stuff ; done
You never did redirect write's stderr to >dev/null like write ... 2>/dev/null to throw away the messages.
Show me what your who output looks like, and I'll find a more elegant way to get what you want than cut | grep | cut | cat, too.
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:
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.
(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)
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)