bashLinux

Adding a -p option to touch

I've sometimes wished that the UNIX touch command had the same -p option as mkdir. With a little bit of scripting, it can: #!/bin/sh mkdir="/bin/mkdir" touch="/usr/bin/touch" for arg in $*; do if [ "$arg" = "-p" ]; then...
bashLinux

Su su sudo: oh no

The other day I wanted to enable IP forwarding on my Linux box (so that it could forward packets from a tun virtual interface being used by VTun to the physical interface connected to my home network). I looked up it up and it...
bashGeneral

Blast from the past: Sniglets

I'm reminded today of Sniglets. I grew up in the 1980s watching lots of HBO, so Rich Hall's little segments from Not Necessarily the News occupy a special place in some dark corner of my cerebrum. I can still remember to this...
bashEmacs

Having a bash with bash

Let's say we want to write a command that allows you to take the output of the previous command and stick it in your editor so you can page through it, save it, email it, etc. One way to do it is with bash's "process...
bash

Stupid bash trick of the day

function _globdo { local arg="$1" local dir=$(dirname $arg) local base=$(basename $arg) shift find $dir -name $base -exec "$@" {} \; set +f } alias globdo='set -f; _globdo' The function/alias combo is get around automatic...