Bash script logging

Bash script logging

use
>> mylog ( after the file, use > to overwrite )
to just append to the file

date >> mylog
ls >> mylog
echo >> mylog

OR if You want all script output go the mylog

#!/bin/bash
exec 1>>mylog
date
ls
echo

Leave a Reply

Your email address will not be published. Required fields are marked *

19 − two =

This site uses Akismet to reduce spam. Learn how your comment data is processed.