0

Ubuntu noob here, I want to send an email where I get subject from variable inside sh script, in script below notice subject variable. Mail is sent but the subject is "$subject" instead of SSH login

#!/bin/bash
##This script sends a message
subject="SSH Login:"
curl -s --user 'api:key-xxxxxxxxxxxxxxx' https://api.eu.mailgun.net/v3/adoptatias.com/messages -F from='Excited User <postmaster@mydomain.com>' -F to='mymail@gmail.com' -F subject='$subject' -F text='Detected succesfull SSH login'


exit 0;

what am I doing wrong?

  • Single quotes prevent variable expansion - see for example https://askubuntu.com/a/20041/178692 – steeldriver Jan 08 '23 at 21:11
  • You've tagged your release as 14.04? Are you sure you're using the 2014-April release, and it's EOSS (end of standard support) thus off-topic here, and only gets security updates/fixes if ESM is applied? – guiverc Jan 08 '23 at 21:26

0 Answers0