Unable to send the output of a command via email
by Satyaveer Arya from LinuxQuestions.org on (#6E19S)
Hello Folks,
I'm trying out below script to send the output of couple of commands to email, whereas, I'm getting the output of $total but not able to get the output of $lags.
Rather, it's picking up email addresses as "southbound-archiver@abc.net", "--group@abc.net", etc. from the first line.
Quote:
Kindly advise how can I get through this and send the output over email.
I'm trying out below script to send the output of couple of commands to email, whereas, I'm getting the output of $total but not able to get the output of $lags.
Rather, it's picking up email addresses as "southbound-archiver@abc.net", "--group@abc.net", etc. from the first line.
Quote:
lags='/opt/kafka/bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group southbound-archiver' total=`$lags | awk '{sum+=$5} END {print "Total number of lags: " sum}'` #Print the calculated value mail -s 'Southound Lags and total number' satyaveer.arya@abc.net <<< $total \n\n $lags |