Monday, 15 October 2007

File viewer

Many files are associated with a special viewer. For example I use less to view text files, eog for images, mplayer for vids and music. Why do I always have to type the appropriate program. Why can't I just call a script that will use the 'file' command and open the appropriate viewer? Basically just a few if cases
if [`file $fileToTest | cut -d' ' -f2` eq "JPEG"] then; eog $fielToTest; fi
and so on.
This must have been done. Does someone know somethinglike this?

You can apply the same idea to editing files too.
So two programs 'e' and 'v' schould be nice.

Thanks to my friend David Garcia Quintas

No comments: