I had the idea come into my head that it would be good to have a single command that gave file type, file size, last modification date, and owner/group information, like what one would see in a GUI "Properties" dialog, but all in a terminal window. In my opinion, these statistics about a file should be available via one command in an xterm or rxvt situation. So I started looking things up.
It turns out that the information such an alias (or script) would return comes from two Linux/Unix commands, "file" and "stat". From file, one can glean mime-type as well as or instead of file type, since most of the time when one types in "file somefile.ext, what comes back is somewhat vague. From stat, one can glean much of the other information (size, last mod date, owner, group).
Now where it falls down for me is in what I don't know about writing scripts. Particularly how to format commands in functions so they handle file name strings entered by the user in the terminal. I've a vague clue there is something on the order of a {FILE} or ${FILE} variable involved, but I can't seem to "stick" the syntax without getting an error returned like "No such file or directory" or something.
Also, if there already is a single command that 'barfs back' the info I'm looking for, I certainly would rather use it than hike further down the scripting path.
I like it so far. Is there some way of trimming the returned data to just the elements I mentioned in the original post? This might sound like I'm in pursuit of a "one from column A, two from column B" thing, and I know from what I started with before your reply, how difficult it was to get even as far as I did. All your help (and others' who may want to pitch in at this point) is appreciated.
I put the above code in a script, and in a weak tribute to my years and years on Macs, changed the name of the function to GetInfo.
There's no need for a backslash after a pipe. It is only necessary when the command would be complete as it stands; a command ending with a pipe (or && or ||, etc.) is not complete, therefore the backslash is unnecessary.
Next exercise: modify the function so that it works on other systems. BSD systems have a stat command that uses a different syntaxt; other systems do not have a stat command.