#!/bin/bash # Display a string of text echo "This is a test email from a bash script." echo "-------------------------------------" # Get the output of the script using command substitution OUTPUT=$(cat /dev/null) # Send the output as an email using mailx (or your preferred MTA) mail -s "Test Email from Bash Script" recipient@example.com << EOF $OUTPUT EOF exit 0