If it won't be simple, it simply won't be. [source code] by Miki Tebeka, CEO, 353Solutions

Tuesday, August 21, 2007


Many times, I open files from the command line.
However each OS has it's own utility for opening file, so I have this little script called start (yes, I started my life on windows ;).

# Open a file from command line, multi OS

# Miki Tebeka <miki.tebeka@gmail.com>

if [ $# -ne 1 ]; then
echo "usage: `basename $0` PATH"
exit 1

if [ ! -e $1 ]; then
echo "error: can't find $1" 1>&2
exit 1

case `uname` in
Linux) open=exo-open;;
Darwin) open=open;;
CYGWIN*) open=cygstart;;
MINGW32*) open=start;;
*) echo "error: no start program for `uname` platform" 1>&2; exit 1;;

$open "$1"
Post a Comment

Blog Archive