27.08.2015 Views

Advanced Bash−Scripting Guide

Advanced Bash-Scripting Guide - Nicku.org

Advanced Bash-Scripting Guide - Nicku.org

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Advanced</strong> <strong>Bash−Scripting</strong> <strong>Guide</strong><br />

# then exec 7 >(exec gawk '{print strftime(), $0}' >> /var/log/event.log)<br />

# Above line will not work in Bash, version 2.04.<br />

exec 7>> /var/log/event.log # Append to "event.log".<br />

log<br />

# Write time and date.<br />

else exec 7> /dev/null<br />

# Bury output.<br />

fi<br />

echo "DEBUG3: beginning" >&${FD_DEBUG3}<br />

ls −l >&5 2>&4<br />

echo "Done"<br />

# command1 >&5 2>&4<br />

# command2<br />

echo "sending mail" >&${FD_LOGEVENTS} # Writes "sending mail" to fd #7.<br />

exit 0<br />

Chapter 16. I/O Redirection 252

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!