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

Ravi Sir's Cards › AWS

AWS Cloud

Script template

This revision card explains Script template. It starts from the need that strict mode. It describes log and die. The how-to section notes lock. An example on the card is temp and cleanup.

Script template Strict mode. log and die. Lock. Temp and cleanup.
Script template · Download PNG
Read card text

What this card says

Why do we need it?

Strict mode.

set -Eeuo pipefail

What is it?

log and die.

die(){ log ERROR "$*"; exit 1; }

How to do it

Lock.

exec 9>/tmp/x.lock; flock -n 9

Example

Temp and cleanup.

trap 'rm -rf "$tmp"' EXIT

See all AWS revision cards