Redirection of standard output
To redirect output simple use the following syntax:
command > /path/to/file /path/to/script.sh > output.txt
For example, send output of date command to a file called now.txt:
date > now.txt
You can also use the > operator to print file, enter:
cat file.txt > /dev/lp0
sudo bash -c "cat file.txt > /dev/lp0"
To make a usage listing of the directories in the /home partition, enter:
sudo bash -c "cd /home ; du -s *│ sort -rn >/tmp/usage"
You can also use the following syntax:
echo "Today is $(date)" 1>/tmp/now.txt