Hello,

i am unable to make this script working, i was playing with quotation marks, but i do not receive e-mail, i tried to replace mailing part by just echo, but nothing is printed. I wanted whole command to be one liner if possible


Code:
#!/bin/bash
#set -exu
clamscanresult="$(/usr/local/bin/clamscan /var/tmp /tmp /home/"$(ls -lt /home|head -n 2|tail -n 1|grep -v root|awk '{print $4}' 2>/dev/null)"/public_html)" && if [[ "$clamscanresult" != *"Infected files: 0"* ]];then echo "Infected files was found: \"$clamscanresult\""|mail -s "ClamScan" me@gmail.com;fi