#!/bin/sh # Pops the directory associated with 'tag' and makes it the current # directory. # requires the following in your .bashrc: # alias pop 'cd `mypop \!^`' # Then you can use: pop mytag # or echo `mypop mytag`, or cat `mypop mytag`/readme.txt mylist="/home/noel/bin/popdirlist.txt" if [ -z "$1" ]; then echo " Syntax: pop n (where n is a tag)" exit 1 fi if [ -f $mylist ]; then grep "^$1" $mylist > $mylist.tmp if [ ! -s $mylist.tmp ]; then echo "No such tag" else awk '{print $2}' $mylist.tmp fi else echo " There isn't anything to pop!" exit 1 fi