Results 1 to 2 of 2
I am trying to write a script that runs a program and provides email notification when the program is complete. I think the best way to do that is to ...
- 07-18-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 1
help writing a wrapper script with input, and mail help
I am trying to write a script that runs a program and provides email notification when the program is complete. I think the best way to do that is to write a wrapper script that takes input, calls the program, and then sends an email.
A rough prototype of this is:
There are two problems with this. You run the scrip, it drops down a line and then you enter your arguments. So currently it does:Code:#!/bin/bash read arguments /usr/bin/program $arguments /usr/bin/mail -s "Program Completed" "mailaddress" < message
How can I get the arguments on the same line as the script? I want it to work like a typical program:Code:./script -tvs
Second, when I try to run /usr/bin/mail I get the following error:Code:./script -tvs
I googled for that error code, but couldn't find anything.Can't send mail: sendmail process failed with error code 255
Thanks in advance.
- 07-26-2010 #2Just Joined!
- Join Date
- Jul 2010
- Location
- Zagreb, Croatia
- Posts
- 9
Hello,
for first problem, remove line with read and in replace $argument in line where you run program with $@.
$@ => all arguments of programCode:#!/bin/bash /usr/bin/program $@ /usr/bin/mail -s "Program Completed" "mailaddress" < message
also:
$1 => 1st argument of program
.
.
$9 => 9th argument of program
$# => number of arguments


Reply With Quote