misc/bash: minor updates to cdfactor script.

db4
John Benediktsson 2014-11-29 20:19:11 -08:00
parent 49afa5b3ed
commit 0f69430f8d
1 changed files with 5 additions and 8 deletions

View File

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
# change directories to a factor module # change directories to a factor module
function cdfactor { function cdfactor {
code=$(printf "USING: io io.pathnames vocabs vocabs.loader ; " code=$(printf "USING: io io.backend vocabs vocabs.loader ; "
printf "\"%s\" <vocab> vocab-source-path absolute-path print" $1) printf "\"%s\" <vocab> vocab-source-path normalize-path print" $1)
echo $code > $HOME/.cdfactor fn=$(factor -e="$code")
fn=$(factor $HOME/.cdfactor)
dn=$(dirname $fn) dn=$(dirname $fn)
echo $dn echo $dn
if [ -z "$dn" ]; then if [ -z "$dn" ]; then
@ -14,5 +13,3 @@ function cdfactor {
cd $dn cd $dn
fi fi
} }