Skip to content

Bash Script tips, tricks, functions, templates, best practices, etc.

Notifications You must be signed in to change notification settings

Ramos04/BreakingBash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Breaking Bash

Bash Script tips, tricks, functions, templates, best practices, etc.

General

BASH STRICT MODE

#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

-e 		Immediately exit upon any non-zero exit code, just like c exits 
		after a seg fault or syntax error in python
-u 		Throws an error and immediately exits when you refernce a 
		variable that is undefined
-o pipefail	Prevents errors in a pipeline from being masked
IFS
names=(
   "Aaron Maxwell"
   "Wayne Gretzky"
   "David Beckham"
   "Anderson da Silva"
 )
WITHOUT STRICT WITH STRICT-MODE IFS
Aaron Aaron Maxwell
Maxwell Wayne Gretzky
Wayne David Beckham
Gretzky Anderson da Silva
David
Beckham
Anderson
da
Silva

Style Guide

Resources

  1. Advanced Scripting Guide
  2. Bash Guide
  3. Bash Style Guide
  4. Linting
  5. Strict-Mode
  6. Exit Traps
  7. Template
  8. Argument Handling

About

Bash Script tips, tricks, functions, templates, best practices, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages