|
|
Automatically create app-launching aliases in bash
There are potential problems with careless aliasing like this.
For instance running the script with changing the relevant awk line changed to
printf "%sn",name
and then
for name in ~/.osxaliases `; do which $name ;done
reveals then various aliases would redefine existing executables in the path. Some of these are actually the same application (automator) but not necessarily (/usr/bin/mail is not the same as /Applications/Mail.app) On top of this, even pure Apple applications may exist as duplicates or just found in volatile source building directories. I suggest that your script does the update in two stages checking potential aliases with `which` after the first stage and does not redefine already existing ones while warning the user. So I suggest writing
printf "%st%sn",name,appl;
to $ALIASFILE (change the relevant line in .profile) and then instead of just sourcing $ALIASFILE in .bashrc, do
cat $ALIASFILE| while read name appl ; do if which $name; then echo $name exists; else alias $name="open -a '$appl'" ;fi; done
Plus, we might want to check if the required aliases already exist as aliases but I'm not sure how to do that other than grepping it from the output of alias. with this duplicates coming from different Application directories could also be detected. For another problem technical see the next post. V |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks 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.24 seconds |
|