Upgrade to Leopard mostly smooth, but has small glitch
Cameron Simpson
cs at zip.com.au
Sat Mar 8 22:23:29 PST 2008
On 08Mar2008 21:48, Bill Hernandez <ms at mac-specialist.com> wrote:
[...snip...]
| I should have used an existing shell script
|
| # shell script : bh_open
| # ------------------------------------------------
| #!/bin/bash
|
| if [ -a /Applications/BBEdit.app ]; then
| open -a /Applications/BBEdit.app $1
| elif [ -a ~/Applications/BBEdit.app ]; then
| open -a ~/Applications/BBEdit.app $1
| else
| open -a /Applications/TextEdit.app $1
| fi
| # ------------------------------------------------
[...snip...]
Surely this does not work? "-a" is "and". Do you mean "-f" or "-x" perhaps?
Personally I'd have just looped over the choices. And you should really
quote the $1, otherwise a filename with spaces in it will bite you one
day:
#!/bin/sh
for app in /Applications/BBEdit.app \
$HOME/Applications/BBEdit.app \
/Applications/TextEdit.app
do
[ -x "$app" ] && exec open -a "$app" "$1"
done
echo "$0: can't find something with which to open $1" >&2
exit 1
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
Everybody talks about the weather, but does anybody *do* anything about it?
- perry at dsinc.com (Jim Perry)
More information about the macports-users
mailing list