<p>Could probably write a wrapper for cat (maybe call it dog) and have it reference /etc/mine.types and/or the file command so that once it understands the 'scent' of the file, it will know how to process the file based off of the preferred application for it.  For instance, if you ran the command:</p>

<p>dog kitty.jpg</p>
<p>, it should know to figure out that it's an image file (file kitty.jpg), check the environment (is ${DISPLAY} set?), figure out which application to use (cross reference with mime.types depending on the environment), and run the appropriate command to display the image.</p>

<p>-Scott</p>
<div class="gmail_quote">On Oct 25, 2011 7:29 AM, "Todd Walton" <<a href="mailto:tdwalton@gmail.com">tdwalton@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now this is clever...<br>
<br>
Display file contents either with less or cat based on number of lines:<br>
<a href="http://www.commandlinefu.com/commands/view/9571/display-file-contents-either-with-less-or-cat-based-on-number-of-lines?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Command-line-fu+%28Command-Line-Fu%29&utm_content=Google+Reader" target="_blank">http://www.commandlinefu.com/commands/view/9571/display-file-contents-either-with-less-or-cat-based-on-number-of-lines?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Command-line-fu+%28Command-Line-Fu%29&utm_content=Google+Reader</a><br>

<br>
out() { tmp=$(mktemp); awk '{print $0}' > $tmp; if [ $(wc -l $tmp |<br>
awk '{print $1}') -gt $(tput lines) ]; then less $tmp; else cat $tmp;<br>
fi; rm -fr $tmp; }<br>
<br>
I mean, not clever for the command line itself, I haven't tried it yet<br>
(about to).  But clever because I have often wanted to do just this<br>
thing.<br>
<br>
I also have often wished for a command that would just show the<br>
contents of a file in a meaningful way based on the file type, instead<br>
of me having to determine the file type first.  'cat' makes sense for<br>
text files, but not for spreadsheets, for example.<br>
<br>
--<br>
Todd<br>
_______________________________________________<br>
Cialug mailing list<br>
<a href="mailto:Cialug@cialug.org">Cialug@cialug.org</a><br>
<a href="http://cialug.org/mailman/listinfo/cialug" target="_blank">http://cialug.org/mailman/listinfo/cialug</a><br>
</blockquote></div>