Hi
I have a script that is sending mail and it was working fine. But the last time it run, it gave some errors. It look like the subject was split into many receiver. I am on AIX 6.1.
#!/bin/ksh
#
HOSTNAME=`which hostname`
MACHINE=`${HOSTNAME}`
# E-mail to inform hci of a stop
echo "### HCI Stop script beginning execution ###" | mail -s "Starting hci_stop on ${MACHINE}" hci
The output was redirected in a log file. Here is what was found in that log file:
axbe04... User unknown
hci_stop... User unknown
on... User unknown
I received the mail but the subject was only "Starting"
It is like the double quote was ignored and mail was thinking that "hci_stop on ${NOMMACHINE}" where the receivers.
As you said, it was working - what is going through my mind is "What else has changed?". e.g., did you recently update AIX? Have you changed your default shell (and there is no "hash-bang aka #! starting the script).
In short, on the face of it, your command should work fine. I have used commands like that many many times with no problem.
Perhaps copy the script (to always have the original) and add "set -x" at the start so that it prints the commands as it executes them.
And/or just try "ksh -x script", if ksh is the shell that is suppossed to be executing it. I would assume (if you are now using bash - that bash also has something similiar.) And, thinking of bash - while I am not a regular user I recall that bash had several patches re: "remote" executition.
So, besides all the other questions you need to answer - also think about what else may have changed that might be the root cause of the issues you are now facing.
The mail is working fine now since we rebooted and the subject of the test is OK "three word subject" add no error, but when it was not working it would be
word... User unknown
subject... User unknown
$ type mail
mail is a tracked alias for /usr/bin/mail
printf '%s\n' "$IFS" "$PATH" "$SHELL" | od -bc
0000000 040 011 012 012 057 161 144 170 057 143 151 163 065 056 070 057
\t \n \n / q d x / c i s 5 . 8 /
0000020 151 156 164 145 147 162 141 164 157 162 057 141 144 164 137 154
i n t e g r a t o r / a d t _ l
0000040 157 147 151 142 145 143 057 142 151 156 072 057 161 144 170 057
o g i b e c / b i n : / q d x /
0000060 143 151 163 065 056 070 057 151 156 164 145 147 162 141 164 157
c i s 5 . 8 / i n t e g r a t o
0000100 162 057 141 144 164 137 154 157 147 151 142 145 143 057 163 143
r / a d t _ l o g i b e c / s c
0000120 162 151 160 164 163 072 057 161 144 170 057 143 151 163 065 056
r i p t s : / q d x / c i s 5 .
0000140 070 057 151 156 164 145 147 162 141 164 157 162 057 142 151 156
8 / i n t e g r a t o r / b i n
0000160 072 057 161 144 170 057 143 151 163 065 056 070 057 151 156 164
: / q d x / c i s 5 . 8 / i n t
0000200 145 147 162 141 164 157 162 057 143 157 156 164 162 151 142 072
e g r a t o r / c o n t r i b :
0000220 057 161 144 170 057 143 151 163 065 056 070 057 151 156 164 145
/ q d x / c i s 5 . 8 / i n t e
0000240 147 162 141 164 157 162 057 163 142 151 156 072 057 161 144 170
g r a t o r / s b i n : / q d x
0000260 057 143 151 163 065 056 070 057 151 156 164 145 147 162 141 164
/ c i s 5 . 8 / i n t e g r a t
0000300 157 162 057 144 142 155 163 057 142 151 156 072 057 161 144 170
o r / d b m s / b i n : / q d x
0000320 057 143 151 163 065 056 070 057 151 156 164 145 147 162 141 164
/ c i s 5 . 8 / i n t e g r a t
0000340 157 162 057 164 143 154 057 142 151 156 072 057 161 144 170 057
o r / t c l / b i n : / q d x /
0000360 143 151 163 065 056 070 057 151 156 164 145 147 162 141 164 157
c i s 5 . 8 / i n t e g r a t o
0000400 162 057 143 154 147 165 151 057 142 151 156 072 057 161 144 170
r / c l g u i / b i n : / q d x
0000420 057 143 151 163 065 056 070 057 151 156 164 145 147 162 141 164
/ c i s 5 . 8 / i n t e g r a t
0000440 157 162 057 143 154 147 165 151 057 152 141 166 141 057 142 151
o r / c l g u i / j a v a / b i
0000460 156 072 057 161 144 170 057 143 151 163 065 056 070 057 151 156
n : / q d x / c i s 5 . 8 / i n
0000500 164 145 147 162 141 164 157 162 057 165 163 145 162 143 155 144
t e g r a t o r / u s e r c m d
0000520 163 072 057 165 163 162 057 142 151 156 072 057 145 164 143 072
s : / u s r / b i n : / e t c :
0000540 057 165 163 162 057 163 142 151 156 072 057 165 163 162 057 165
/ u s r / s b i n : / u s r / u
0000560 143 142 072 057 165 163 162 057 150 143 151 145 156 147 057 150
c b : / u s r / h c i e n g / h
0000600 143 151 057 142 151 156 072 057 165 163 162 057 142 151 156 057
c i / b i n : / u s r / b i n /
0000620 130 061 061 072 057 163 142 151 156 072 056 072 057 165 163 162
X 1 1 : / s b i n : . : / u s r
0000640 057 154 157 143 141 154 057 142 151 156 072 057 165 163 162 057
/ l o c a l / b i n : / u s r /
0000660 154 157 143 141 154 057 163 143 162 151 160 164 163 072 057 161
l o c a l / s c r i p t s : / q
0000700 144 170 057 142 151 156 012 057 142 151 156 057 153 163 150 012
d x / b i n \n / b i n / k s h \n
0000720
So, knowing that things work after a reboot tells us that something was messed up in your environment. But, since you didn't show us the results until after you rebooted, we'll probably never know what was wrong. (It would have also been nice to know if logging out and logging back in would have solved your problem without rebooting.)
But, my best guesses would still be that either your IFS setting had been modified to include the double-quote character or that your PATH setting had been modified to find a different mail utility than the one you're now finding in /usr/bin .