MacOS open’s under Linux
MacOS has a nice “open” command that will open any document with any application from the command line. I hacked my own for Linux for a bash shell:
TEMP=`getopt -o a: -- "$@"`
if [ $? != 0 ] ; then exit 1 ; fi
eval set -- "$TEMP"
while true ; do
case "$1" in
-a) COMMAND=$2 ; shift 2;;
--) shift ; break ;;
*)echo "should not happen" ; exit 1 ;;
esac
done
if [ $COMMAND ]; then
nohup $COMMAND $@ > ~/.s1 2> ~/.s2 &
else
/usr/bin/xdg-open $@
fi
Montreal, Canada 
Facebook
Friendfeed
LinkedIn
SlideShare
Delicious
If you are running GNOME, you can also use the command “gnome-open”.
Comment by Jo Vermeulen — 22/9/2008 @ 4:06
Hmmm, it’s not completely equivalent because “gnome-open” doesn’t allow you to choose the application you want to use, it always uses the default one.
Comment by Jo Vermeulen — 22/9/2008 @ 4:54
And… if a given file type has no default application? Then gnome-open fails.
Comment by Daniel Lemire — 22/9/2008 @ 6:22
Plus, what if you are not using gnome?
Comment by Daniel Lemire — 22/9/2008 @ 6:23