I recently decided to replace myself with a bunch of small shell scripts in as many tedious daily routine tasks as I can. But knowing how rusty my scripting skills were I decided to refresh my knowledge a little bit.
Here is advice, resources and tools I found useful on this journey:
- Try writing portable scripts.
- Forget Bash, understand what POSIX shell is.
- Watch the Shell Haters Handbook video.
- Use this POSIX Reference.
- Dash as /bin/sh is a useful collection of portability challenges.
- Install ShellCheck (
brew install shellcheckwhen using HomeBrew).
- Add ShellCheck to your editor (automagically works when using Vim+Syntastic).
- Write tests to verify your scripts. Roundup is a simple and useful test runner, check this page out for a more thorough overview of the options.
And what’s next once we mastered shell scripting? Maybe learn AWK…