I have a file cutshellb.txt, which contains four report names (but it could be any number from 1 to x. The report suffix is not necessarily consecutive:
report3785
report3786
report3787
report3788
I have a shell script which attempts to read the names and use them as a parameter in another script to run a mail package:
#!/bin/ksh
for line in `/usr/bin/cat /u1/cutshellb.txt`; do
/u1/sendreportmail.sh MYPRT=$(`echo "$line"`) 1>sendmail.log 2>&1
done
I would appreciate some pointers - even if it is just that this is not possible.
I found this format MYPRT=$(`echo "$line"`) on a website which suggested that there are difficulties with passing variables between parent and child processes with pipes especially within ifs and whiles.
But why not simply incorporate the mailsend command into the orriginal script ?
like:
#!/bin/ksh
for line in `/usr/bin/cat /u1/cutshellb.txt`; do
/u1/mail/bin/mailsend -i -vvvv -tany_person@mailaddress.uk -s "Mail report "
-a/u1/$line.pdf " " 1>sendmail.log 2>&1
Just a quick thank-you both for your help.
Have now incorporated into the one process and am using 'for word in...' and the alternative 'while IFS' successfully