Useful scripts - a+/a-
This is the first post of a series describing simple scripts that I wrote to ease my life as a programmer.
They are implemented in various languages (
go) and thought to be used in
Linux. Some of them are "general purpose", while others are specifically designed to interface other tools I use (for example,
All of them tend to have the following properties:
- Input from
stdin, output to
stdout, errors to
- Return zero on success, non-zero on failure
- Do one thing only
- Not too much customizable
These properties allow the scripts to remain very simple, be composable and easy to remember.
They are available on github: fork & hack at will!
a+ indents every line of
stdin by 4 spaces.
a- "de-indents" it by the same amount. The amount of spaces (4) is fixed (to resist the temptation to change it), and indentation is done with spaces and not tabs.
# !/usr/bin/env rc sed 's/^/ /'
# !/usr/bin/env rc sed 's/^ //'