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
user1794469
  • 4,067
  • 1
  • 26
  • 42

1 Answers1

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
user1794469
  • 4,067
  • 1
  • 26
  • 42