New blog domain: kula.blog

It's still work in progress but new posts will be published on  https://kula.blog/ Thanks to 11ty base blog RSS is working from the start so it should be easy to add to your reader if you still use any :) If now then I hope you can sign up to the newsletter where I'll be publishing new posts and interesting articles to it from time to time. Please use  kula.blog  from now on.

5 things I learned from "How to train your BASH" by Marcin Stożek "Perk"



Today I've watched a presentation by Marcin Stożek called How to train your BASH and wanted to remember the most interesting points for later.


1. It's best if you follow a style guide

There seems to be only one though Google Shell Style Guide.

2. You can set Bash to "strict mode" 

It sets more human-friendly defaults and makes sure you won't miss any errors in your scripts.

#!/bin/bash

set -euo pipefail

IFS=$'\n\t'


3. Shellcheck

Turns out there is a tool called shellcheck that can help you write scripts that you intended to write. Best thing is that it explains what's wrong and gives you suggestions on how you can fix it.

4. You can enable 'debug mode' when running your script

Just pass "-x" to the script eg.

 > bash -x ./my_script.sh


5. Use Pure Bash

No one wants to see weird errors when running the script on a new server so it's best if you avoid using external programs in your scripts. 



There is much more in the presentation so take a look at it: https://slides.com/perk/jak-wytresowac-basha#/

Comments

Popular posts from this blog

How to use NPM packages from private repositories on bitbucket

How to simulate slow connection (developer proxy in Node.js)