Skip to content

ThomWright/bash-resources

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bash resources

Some resources to help me write good (or at least better) Bash scripts.

Please see the accompanying template.

  • Template - Template for starting new scripts.
  • Snippets - Reusable snippets.
  • Scripts - A collection of full scripts.

Tips

  • Use a recent version of Bash.
    • MacOS (at the time of writing) uses an old version of Bash by default (3.2). Upgrade with e.g. brew install bash.

Writing scripts

Tips for writing scripts, as opposed to interactive command line use.

  • Use ShellCheck.
  • Always prefer long form parameters (e.g. --long-form) over short form (e.g. -l).
    • This makes scripts much more readable.
  • Prefix variables with local inside functions.
    • Variables are globally scoped by default. This reduces the scope to just the function.

Tricks

Resources

About

Resources to help me write better Bash scripts

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages