[openbeos] J
- From: "Michael Phipps" <mphipps1@xxxxxxxxxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Sat, 17 May 2003 22:46:43 -0400
Some time ago, I posted a few line script function called "j" - a tool for
jumping to directories.
And, as far as it goes, it is a pretty good script.
The problem that I have had with it is that sometimes I want to "j" to a
directory that does not have a unique name.
Currently, j has real issues with that (to put it nicely).
So I finally got frustrated enough and put a little more effort into j. Here is
the result:
function goThere() {
if [ -d $1 ] ; then
echo $1
cd $1
return $?
fi
return 1
}
function j() {
declare -a choices
choices=(`query "name=$1" | tr '\n' ' '`)
case "${#choices[@]}" in
"0") return 1;;
"1") goThere ${choices[@]} ; return $?;;
*) PS3='Choice: '
select curChoice in "${choices[@]}"
do
goThere $curChoice
if [ $? -eq 0 ] ; then
break
fi
done
esac
}
Comments, thoughts, issues, questions?
- Follow-Ups:
- [openbeos] Re: J
- From: Alan Ellis
Other related posts:
- » [openbeos] J
- » [openbeos] Re: J
- » [openbeos] Re: J
- » [openbeos] Re: J
- » [openbeos] Re: J
- » [openbeos] Re: J
- [openbeos] Re: J
- From: Alan Ellis