I have a basic script that looks like this:
#!/bin/bash
### run these 2 commands and dump the contents to a file
run command 1 > /dir/file1
run command 2 > /dir/file2
##### run this command, echo the output and email me if $var is above a certain # and send the contents of the dump files in the email
var=$(netstat -an | wc -l)
echo $var
if [ "$var" -ge 700 ]; then
cat /dir/file1 /dir/file2 | mailx -s "System X has over $var connections. " email recipients
fi
What I need to do is label the contents to distinguish between the 2 files so when I get the email I know what output came from command 1 and what came from command 2. What is the best way to do this?