git init
Welcome to the initial post of the blog I am calling standard in
.
The idea of this blog is to keep track of all the cool software development stuff I learn in 2017.
My goal is to post 5 times per week. Each post will be a short snippet that represents something I learned that day.
To kick it off, today I learned how to debug bash scripts. I previously relied on echo
abuse to print the value of variables as a script ran. It meant adding, then deleting, many lines of code and carefully avoiding typos. Now, I know to use one of these techniques instead:
- set the
-x
switch at the top of the file (next to#!/bin/bash
) - use
set -x
andset +x
to turn debugging on and off inside a script - or just run the script by passing
-x
as an option:bash -x myscript