Skip to content

Instantly share code, notes, and snippets.

@roktas
Created December 11, 2014 22:08
Show Gist options
  • Save roktas/94947914c1c58a0e4f41 to your computer and use it in GitHub Desktop.
Save roktas/94947914c1c58a0e4f41 to your computer and use it in GitHub Desktop.
#!/bin/bash
docview() {
if [[ -f $1 ]] ; then
case $1 in
*.pdf) evince "$1" ;;
*.ps) evince "$1" ;;
*.odt) oowriter "$1" ;;
*.txt) leafpad "$1" ;;
*.doc) oowriter "$1" ;;
*)
echo "don't know how to view '$1'..." >&2
return 1
;;
esac
else
echo "no such file: '$1'" >&2
return 1
fi
}
main() {
docview "$@"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment