Created
December 11, 2014 22:08
-
-
Save roktas/94947914c1c58a0e4f41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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