cat $(ls -Ft | grep -v '/' | head -1)
cat $(ls -Ft | grep -v '/' | head -1) | mail -s "Latest file" email_address@domain.com
while :
do
cat $(ls -Ft | grep -v '/' | head -1) | mail -s "Latest file" Email_Address@domain.com
#wait for 30 seconds
sleep 30s
done
You want to read the latest file from a folder
Open in new window