Saturday, September 1, 2018

Best practice for writing shell scripts




Add this snippet at the top of your scripts to get a log of what they did, every time they run. This can help when writing new scripts or debugging something that fails after the fact. 

I've used this a lot when building scripts to auto-configure hosts after booting.  Capturing the output of these scripts can be awkward and it's valuable data to  analyze what happened on a failed build, even days later.

No comments:

Post a Comment

AWK Command - In an Easy way

Awk stands for Aho Weinberger and Kernighan. Awk is a scripting language to process and analyze files. Some of the features of Awk ...