linuxbashmailx

Sending mail with bash argument from command line in subject


I have the following code and I wanted the argument -s too to use the first argument of my bash script. How do I ensure it happens as it prints $1 straight for the subject, though the message body has $1 interpreted correctly as it goes through the echo statement.

echo "Converse Log Labels $1" | mailx -a conversation_logs_"$1".tsv -s "Converse Logs Labels Data "$1"" vk@aol.com

Solution

  • echo "Converse Log Labels $1" | mailx -a "conversation_logs_$1.tsv" -s "Converse Logs Labels Data $1" vk@aol.com