0

I have the following code and I wanted the argument to -s to include the first argument of my bash script. Currently it prints "$1" verbatim for subject though the message body has $1 evaluated correctly in the echo statement

echo "Converse Log Labels $1" | mailx -a conversation_logs_"$1".tsv -s "Converse Logs Labels Data "$1"" username@example.com
0

It looks like you are closing your quotes just before the $1 and then opening and closing a new set after. You could try:

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

or if you want the quotes included:

echo "Converse Log Labels $1" | mailx -a conversation_logs_"$1".tsv -s "Converse Logs Labels Data \"$1\"" username@example.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.