#!/bin/sh - MYBIN="$HOME/binp" pref='libreoffice ooffice soffice' # office - system *office front-end with some extension corrections # Steve Kinzler, kinzler@cs.indiana.edu, Dec 10/Jul 11 # http://www.cs.indiana.edu/~kinzler/home.html#unix # KLUDGE to rename a single-arg .doc file that's actually a .docx case "$1" in *.doc) case `file "$1"` in *[Zz]ip\ archive*) echo "$0: renaming $1 to $1x" if mv "$1" "$1"x then x="$1"; shift set x "$x"x ${1+"$@"}; shift fi;; esac;; esac case "$OFFICECMD" in '') path=${BACKPATH-`echo ":$PATH:" | sed "s:$MYBIN::g; s/^://; s/:$//"`} OFFICECMD=`wh -p "$path" $pref 2> /dev/null | sed 1q`; export OFFICECMD;; esac exec "$OFFICECMD" ${1+"$@"}