Preventing Bash Script Disasters

1) Use set -u (Just put set -u at the top of the script):

2) Use set -o pipefail:

3) Use set -e:

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kanishk Dudeja

Kanishk Dudeja

More from Medium

Install ROS2 Foxy

Fixing low sound volume in Linux

Simple Raspberry Pi Lite setup with SSH and VS Code from Linux Mint

How I use an old laptop as a local server