Tilde commands not working

Hi

I have a script that it sends emails to various recipients using mailx , but some of the recipients should be sent as BCC, but ~b flag when used in the following line, does not put the gmail address as BCC:

echo "node $output is down" | mailx -s "$output not pinging"   sadf@xyz.com ~b sadf@gmail.com

Both email addresses appear on the TO: field of the outlook message

Hi,

Assuming that flag is supported in your implementation of mailx , I'm almost certain it should be -b rather than ~b . Certainly I just checked the Solaris man page for mailx , and it lists the BCC flag as being -b . I've never, ever heard of any command taking flags with a tilde rather than a dash. You should also probably put it before the recipient's address, and not after.

Why in the world do you use a tilde to introduce a command line option? Use a dash! And, read the man page on tilde escapes.

I have used -b flag I have the the following error when running my script:

Invalid operation mode f

I have only used ~b because its stated in Solaris Advanced User's Guide

In that link is stated:

i.e. when you're in the middle of writing your text, use tildes, NOT on the command line!

Hi,

Did you also move the BCC flag and its address to before the recipient address, or are you still adding it afterwards ? In general you'll want all parameters to be listed before the recipient.

1 Like

That did the trick, but for some reason I have not received the notification from my gmail account

Hi,

The best thing then would be to check your mail server's log, and see if it actually did send it and what response it got if it did. If you're on a Solaris 10 system that's using a default Sendmail configuration, then this will most likely be writing its log entries to /var/adm/messages .

Solaris logs mail.debug to /var/log/syslog normally.