Posts Tagged ‘script’

Simple Nerdy Pleasures

Sunday, October 12th, 2008

Sometimes I find myself typing something over and over in a bash window and even with tab-completion, it’s still boring and tedious, in a sort of first-world no-one-is-killing-me fashion. But it’s still more work than I want to be doing, as a terminally lazy softcase. So I wrote a little one-off script to do the work for me. Like so:


#!/bin/bash

echo Indexing $2 as level $1/$3
if [ ! -d by-start-level/$1 ];
then
mkdir by-start-level/$1
fi
cd by-start-level/$1
ln -s “../../$2″ ./$3
cd -

The effect I’m going for here is to end up with a symlink farm of files, indexed by minimum character level.  Pulling that out of the files themself is more work than I wanted to do, but it’s easy enough to open a file, eyeball grep out a number, and then call the script with the original name, character level and destination short name.  As a side-effect I can group otherwise unrelated files thematically.  So I can have a set of adventures designed for 5th level characters with a short handle of run_this_next-1, run_this_next-2 or use-these-maps-4 or whatever.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...