Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/j1elo/shell-snippets

Some Bash shell snippets, with functions and utilities that I use frequently in my scripts.
https://github.com/j1elo/shell-snippets

Last synced: 2 months ago
JSON representation

Some Bash shell snippets, with functions and utilities that I use frequently in my scripts.

Awesome Lists containing this project

README

        

# shell-snippets

Sample Bash scripts that follow best practices learnt from a variety of sources.

## Sources

These are some good resources with tips on how to write good-quality shell scripts:
- [Shell Scripts Matter](https://dev.to/thiht/shell-scripts-matter), proposes a template that you can use for all your scripts.
- [Writing robust Bash shell scripts](http://www.davidpashley.com/articles/writing-robust-shell-scripts) is another detailed article about safety measurements in Bash scripts.
- [Common shell script mistakes](http://www.pixelbeat.org/programming/shell_script_mistakes.html) completes the pack with even more recommendations.

It is wise to follow the recommendations of more experienced players, because they have already fought some battles that you still haven't even anticipated:
- [Google´s shell style guide](https://google.github.io/styleguide/shell.xml)

I also like a couple of pages with examples and description of common errors that Bash programmers make:
- [Bash pitfalls](http://mywiki.wooledge.org/BashPitfalls)
- [The Bash Hackers Wiki](http://wiki.bash-hackers.org)

Last but not least, **always use this tool to verify your scripts**: **[ShellCheck](https://www.shellcheck.net)**. It can be installed as a plugin in lots of text editors and IDEs.

Happy coding!