Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cards › AWS

AWS Cloud

Safe script template

This revision card explains Safe script template. It starts from the need that strict mode. It describes usage and exit 2. The how-to section notes temp and cleanup. An example on the card is quote every var.

Safe script template Strict mode. Usage and exit 2. Temp and cleanup. Quote every var.
Safe script template · Download PNG
Read card text

What this card says

Why do we need it?

Strict mode.

set -euo pipefail

What is it?

Usage and exit 2.

usage(){ ...; exit 2; }

How to do it

Temp and cleanup.

trap 'rm -rf "$t"' EXIT

Example

Quote every var.

"$file"

See all AWS revision cards