Using my solution, I can now launch GUI apps from the command line, complete with Tab completion. For instance, I type iMov[Tab][Enter], and iMovie HD launches; iTu[Tab][Return] for iTunes, etc.
Here's how I did it. First, I created an Apps directory in my user's home directory, and added it to the $PATH variable. Then I placed the following script in the new Apps directory. I named it generatelinks.sh and made it executable with chmod a+x generatelinks.sh:
#!/bin/sh
cd ~/Apps
find -E /Applications/ -regex ".*\.app$" -print |
while read APPS; do
APPLINK=`echo -n "$APPS" | sed s:".*/":"": | sed s:" ":"__":g`
echo $APPLINK
ln -s open.sh "$APPLINK"
done
I then ran the script, and it generated a link for each application in /Applications to the following script in the same Apps directory. This one is named open.sh, and again, remember to chomd a+x open.sh to make it executable:
#!/bin/sh
APP=`echo -n $0 | sed s:"__":" ":g | sed s:".*/":"": | sed s:".app":"": `
echo $APP $1
open -a "$APP" $1 $2 $3
Once the generatelinks.sh script has run, you're done -- you can now launch anything in /Applications by just typing a portion of its name and hitting Tab then Return. I'm sure it could be done with more efficient sed stuff (comments welcome!), but ... it does the trick for me, and as I'm not writing shell scripts every day...
[robg adds: I tested this, and it does indeed work as described. If you're going to use it regularly, you'll probably want to use cron or some other mechanism to run the generatelinks.sh script on a scheduled basis. If you have applications in multiple places, as I do, you can modify the find command in the first script. Just put additional paths between the -E and the -regex bits on that line:
find -E /Applications/ /Volumes/Apps/Utils -regex ".*\.app$" -print |
Finally, if you change the open.sh script name, make sure you change the reference in generatelinks.sh, too.]

