Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'bash version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
bash version
Authored by: beehive on Apr 04, '02 11:01:40AM

Actually that should be:
find $dir -name '*.app' -prune -exec make_alias {} ':' >> "$ALIASDIR/$file"
you also might want to use:
name=$(echo $app | perl -pe 'tr/A-Z/a-z/; s/[( )]+//g;');
instead (Strips spaces instead of stripping s's)


I didn't like the check all time so I modified this for a nightly cron

make_alias file:

#!/bin/sh

for file in "$@"; do
if [ -e "$file" ]; then
app=$(basename "$file" .app);
name=$(echo $app | perl -pe 'tr/A-Z/a-z/; s/[( )]+//g;');
echo "alias ${name}='open -a "${app}"'";
else
echo "No such file: $file";
fi
done


and gen_aliases file:

#!/bin/sh

OSXDIRLIST="/Applications /Developer/Applications ${HOME}/Applications"
ALIASFILE="${HOME}/.aliases"
: > $ALIASFILE

if [ ! -e $ALIASDIR ]; then
mkdir $ALIASDIR
fi

for dir in $OSXDIRLIST; do
if [ -d $dir ]; then
find $dir -name '*.app' -prune -exec make_alias {} ';' >> "$ALIASFILE"
fi
done


cron gen_aliases and to .bash_profile add:

source .aliases




[ Reply to This | # ]