On Sun, Mar 27, 2011 at 11:36 PM, Narendra Sisodiya
<[email protected]> wrote:
> in your bashrc command you can add following function,
>
>
> openit() {
>
> FILE=$1
> if [ $(file $FILE | grep -q "OpenDocument Text"; echo $?) -eq 0 ]; then
> oowriter $FILE; fi
if you want to add command for pdf then use following method,
$file sample.pdf
sample.pdf:
PDF document, version 1.3
"PDF document" is the keyword here, so the syntax will be
if [ $(file $FILE | grep -q "PDF document"; echo $?) -eq 0 ]; then
okular $FILE; fi
or
if [ $(file $FILE | grep -q "PDF document"; echo $?) -eq 0 ]; then
evince $FILE; fi
depending on your test and available, we can further add logic for
detecting if okular or evince is available or not. we can also add
priorities too in logic.
If you like it, then please modify it, add more openers...
--
LUG@IITD - http://lug-iitd.org/Footer