I updated Advancing in the Bash Shell a bit. A new link at the bottom, some very small wording corrections and a syntax highlighter plugin to make the examples a bit easier (I hope!) to read.
Tag Archives: bash
Type less, smile more
How many times a week do you type /etc/init.d/blah start and then you realize you’re on HP-UX and it’s /sbin/init.d/blah Forget it. # Turn on extended globbing and programmable completion shopt -s extglob progcomp export MYOS=$(uname -s) if [[ “${MYOS}” = “Linux” || “${MYOS}” = “SunOS” ]] ; then INITDIR=’/etc/init.d’; else INITDIR=’/sbin/init.d’; fi export INITDIR; …
Be yourself, even when you’re root
Ever run a command only to realize you’re not root but need to be? Of course you have. What if that command was long and painful to create? There’s no reason, Dude, to not have access to your bash history even after becoming root vi ‘su’. function su () { local SUUSER=root local ORIGU=$USER local …
Bash SSH Happiness
So Dennis? (whose name doesn’t appear anywhere on his blog except for in the URL) wrote a cool bash script to create aliases for every host in your ~/.ssh/known_hosts file. I found some bugs/problems so I spiffed it up a bit. As the comments say, you should pipe the output to sort(1). I’ve tried to …
Bash & Screen
You may be familiar with my tutorial on getting your ssh-agent to work inside screen. If not, have a look. There’s always room for improvements! Here’s an excerpt from my current .bash_profile: function Attach(){ grabssh if [[ -z “${1}” ]] ; then local n=`screen -wipe | egrep -i ‘attached|detached’ | wc -l` if [[ “${n}” …