Paste: cd factor

Author: mrjbq7
Mode: shellscript
Date: Wed, 25 Feb 2009 17:08:09
Plain Text |
# change directories to a factor module
function cdfactor { 
    code=$(printf "USING: io io.pathnames vocabs vocabs.loader ; "
           printf "\"%s\" <vocab> vocab-source-path (normalize-path) print" $1)
    echo $code > $HOME/.cdfactor
    fn=$(factor $HOME/.cdfactor)
    dn=$(dirname $fn)
    echo $dn
    if [ -z "$dn" ]; then
        echo "Warning: directory '$1' not found" 1>&2
    else
        cd $dn
    fi
}

New Annotation

Summary:
Author:
Mode:
Body: