I am attempting to send an email using a BASH script and it works fine but I am unable to set the From Address. I am using the mailx command. I am always met with the mailx: illegal option -- r error. Here is what my code looks like;
macSerialNumber=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print $NF}')
loggedUser=$(ls -l /dev/console | awk '/ / { print $3 }')
echo "The Asset Management Script was ran on this machine, the Serial Number is $macSerialNumber and the Username is $loggedUser" | mailx -s "Asset Management $macSerialNumber | $loggedUser " -c tes.test1@gmail.com -r test.test2@gmail.com test.test3@gmail.com
I am writing the script in regular Mac OSX Catalina, any suggestions?