Bash magic
Posted on by Petr Moravek
Category: bash
People find the bash a good tool to fulfill miscelaneous tasks. I do also have some nice ones.
The exec trick
To redirect stdout+err to file when non-interactive.
#!/bin/bash
[ -d "$HOME/log" ] || mkdir "$HOME/log"
if [ ! -t 1 ] ; then
exec >$HOME/log/mylog.log 2>&1
fi
Autocompletion
openstack complete
TO-DO: Unclutter from logging … Python Logging