|
|
bash version
I broke part of it into a script, but it's essentially the same thing. Place the following file make_alias in your ~/bin directory (make one if necessary mkdir ~/bin).
#!/bin/bash
# make_alias
for file in "$@"; do
if [ -e "$file" ]; then
app=$(basename "$file" .app)
name=$(echo $app | perl -pe 'tr/A-Z/a-z/; s/[s()]+//g;');
echo "alias ${name}='open -a "${app}"';"
#echo "function ${name} () { open -a "${app}" "$@" & }"
else
echo "No such file: $file";
fi
done
In your ~/.bash_profile insert the following code
OSXDIRLIST="/Applications /Developer/Applications ${HOME}/Applications"
ALIASDIR="${HOME}/.osxaliases"
if [ ! -e $ALIASDIR ]; then
mkdir $ALIASDIR
fi
for dir in $OSXDIRLIST; do
if [ ! -d $dir ]; then
echo "No such dir: $dir";
else
file=`echo $dir | sed -e 'y#/#_#'`
if [ "$dir" -nt "$ALIASDIR/$file" ]; then
echo "Updating $dir aliases..."
rm -f "$ALIASDIR/$file"
find $dir -name '*.app' -prune -exec make_alias {} >> "$ALIASDIR/$file" ;
fi
source $ALIASDIR/$file
fi
done
That should do it for all you bash fiends.
bash version
Actually that should be: |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.10 seconds |
|