LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-11-2005, 08:49 AM   #1
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Rep: Reputation: 16
bash/ksh variables question


Dear All,
I have a ksh script (main.ksh) that reports the existence or not of specific files. The script is working fine, but I would like to have a better error report mechanism. Thus, I have created 3 e-mail templates (plain text files) that I would like to send at specific e-mail accounts regarding the error code.

The 3 e-mails are different, and I would prefer to have them as plain text files that the script reads them, change the variables and send it.

As an example, here is one of the 3 files:

Code:
This is the report script.
You received this e-mail because file check failed to run at ${RUNDATE}/${RUMONTH}@${RUNTIME}:${RUNMINUTE}.

The file check is scheduled to run again at ${RUNDATE}/${RUMONTH}@${NEWRUNTIME}:${RUNMINUTE}.
Now, what I want, is the "main.ksh" script read that file, substitute the variables and send the e-mail. What I need to help me is the variables substitution. Can anyone help me?

Thank you in advance,
Peter
 
Old 08-11-2005, 10:23 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Why not just do this in the script itself? (this reduces issues of debugging and maintenance as well)
Code:
echo "You received this e-mail because file check failed to run at ${RUNDATE}/${RUMONTH}@${RUNTIME}:${RUNMINUTE}.

The file check is scheduled to run again at ${RUNDATE}/${RUMONTH}@${NEWRUNTIME}:${RUNMINUTE}. " | sendmail someuser@somewhere.org
 
Old 08-11-2005, 10:39 AM   #3
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Original Poster
Rep: Reputation: 16
That's the easy way, but that script wil be installed to a production server. I cannot change it any time I would like. Thus, (and the fact that I will learn something new ) , I have to go the hard way.

In case no one answer, I will go the easy way .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
processing a ksh shell in bash environment ntoughe Programming 9 09-12-2005 06:09 AM
shell confusion..what is diff between bash, ksh, csh, tcsh..?? servnov Linux - Newbie 7 11-18-2004 09:28 PM
bash script - variables & arrays question rblampain Linux - Software 4 09-25-2004 10:57 AM
ksh commands in bash nkelle Linux - General 2 11-13-2003 12:11 PM
BASH variables evaluation question. Thetargos Programming 11 08-11-2003 05:11 AM


All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration