The included commands are ksh/bash shell functions that make it easy to move between directories. The directory locations are saved for re-use between sessions (unlike pushd and popd). Installation consists of creating the directory ~/.going and cut and pasting a section of this file into an appropriate file in your directory (details given below). SUMMARY of COMMANDS here Assigns a permanent name to the current directory. E.g. $ cd /some/where/with/a/long/name $ here stuff go The reverse of here. It 'go'es back to a directory. E.g. $ go stuff (cd's to /some/where/with/a/long/name) there (requires awk and grep) lists the places you can 'go'. E.g. $ there long => stuff /some/where/with/a/long/name on Used to access named directories in cp, mv, and etc. E.g. $ cp /home/fred/bin/hisutility `on stuff`/shared_utility u , dn I include these because I like them and want to copy this distribution file to sites where I work. They go Up and DowN the directory tree. E.g. $ u (same as cd ..) $ dn n (cd into first of n, n*, *n, or *n*) PREREQUISITES Here, go, on, require 'cat'. There requires 'awk' and 'grep'. INSTALLATION 1) mkdir ~/.going 2) Place the following fuctions in an appropriate file, such as ~/.bashrc or ~/.ksh, or "source" them from any other file using the . command. --- CUT --- function go() { cd `cat ~/.going/${1-_back} || echo .` ; } function on() { echo "on `cat ~/.going/${1-_back} || echo .`" 1>&2 ; cat ~/.going/${1-_back} || echo . ; } function here() { pwd > ~/.going/${1-_back} ; echo "go $1 will go to `pwd`" } function there() { ( cd ~/.going ; grep '' * ) | awk '{ FS=":" ; printf("%-10s %s\n",$1,$2); }' | grep -i -E ${1-.\*} ; } # you may not wish to use these, Up, DowN, SEe # function u() { cd .. ; } # function dn() { cd $1 2>/dev/null || cd $1* 2>/dev/null|| cd *$1 2>/dev/null|| cd *$1* } # function se() { more "$@" ; } --- END --- On some systems you may need to edit the function syntax slightly. E.g. function example() { somecommand ; } ; ^1 ^2 ^3 At ^1 you may need to remove the ()'s. At ^2 and ^3 you may need to add or remove a semi-colons. NAME alternatives to pushd/popd, and cd. SYNOPSIS here [name] (default name = _back) go [name] (default name = _back) there [grep-E-expresssion] default = .* on [name] (default name = _back) DESCRIPTION 'here' assigns a name to a directory, and saves the name for later use by 'go'. With no parametre the name _back is used. 'go' returns you to a directory. The parametre is the name assigned earlier with the 'here' command. With no parametre the name _back is used. 'there' lists the assigned names and paths. If specified, a parametre filters the list. Filter words can be OR'd with the | character (which may have to be escaped for the shell). 'on' displays the complete name of a saved directory. This is useful for embedding the directory name in shell commands (using ` ` quotes). Notice that wild cards can be used in the "name" parametre to make the command even shorter. (It may sometimes have to be escaped.) E.g. Instead of "go freds_bin" you could likely enter the even shorter command "go fred\*". EXAMPLES A typical session might look like the following (output denoted by =>) = save my own bin location for later $ cd ~/bin $ here mybin => go mybin will go to /home/malcolm/bin = later, to return to my own bin directory $ go mybin = later still, when I've forgotten where I can 'go' $ there => mybin /home/malcolm/bin => sbin /usr/local/sbin => cgi /var/lib/httpd/cgi-bin ...etc... Some more 'there' examples $ there bin # name or path contains 'bin' => mybin /home/malcolm/bin => sbin /usr/local/sbin => cgi /var/liv/httpd/cgi-bin $ there ^my # name starts with 'my' => mybin /home/malcolm/bin => mysrc /home/malcolm/bin/src $there bin\|cgi # look for 'bin' OR 'cgi' => mybin /home/malcolm/bin => sbin /usr/local/sbin => cgi /var/lib/httpd/cgi-bin => modules /var/lib/httpd/cgi-bin/perl/modules Example of copying a file into and out of the "mybin" directory saved previously. $ cp faz `on mybin`/faz $ mv `on mybin`/foo /usr/local/foo AUTHOR Malcolm Dew-Jones. yf110@victoria.tc.ca COPYRIGHT GNU Copyleft. This software is provided AS-IS in the hopes that it will be useful, and comes with no warranty of any sort. BUGS The top row of the there output is not formatted as nicely as the other rows. Other bugs?