By Marc, on December 22nd, 2006%
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
opt_p=true
continue
. . . → Read More: Adding a -p option to touch
By Marc, on October 20th, 2006%
Here’s a useful tip on how to make bash check the window size between commands.
shopt . . . → Read More: Useful tip on how to make bash check the window size between commands
By Marc, on May 17th, 2006%
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 turns out that it’s a simple setting in a file in the /proc . . . → Read More: Su su sudo: oh no
By Marc, on April 30th, 2006%
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 day:
flen – the yucky stuff that accumulates under the cap of a ketchup bottle.
accello-yellow . . . → Read More: Blast from the past: Sniglets
By Marc, on April 29th, 2006%
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 substitution” feature. Try this:
$ ls -l
$ cat <($(tail -1 $HISTFILE)) | vim . . . → Read More: Having a bash with bash
By Marc, on March 12th, 2006%
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 globbing and make it possible to specify glob . . . → Read More: Stupid bash trick of the day
By Marc, on June 29th, 2005%
Brian took my cd bash function hack, made a whole bunch of improvements, and created a Sourceforge project for it:
recd . . . → Read More: “recd” on sourceforge