Great thread, I had forgotten some of the suggestions.
Here is code embodying all of the above, plus
uname -a. It can be redundant, but it
is comprehensive.
Code:
# find *nix distro/version/release info.
_divider () {
echo -e "======================\n"$@"\n-----------------"
}
_execute () {
_divider $@
$@
}
# main line, pipable or redirectable
{
_execute lsb_release -a
for X in {/etc/*{release,version}*,/proc/version}
do
_divider $X
cat $X
done
_execute uname -a
} | less -S
Tested on "MEPIS 7.0 (upgradable from Debian etch)".
Notes
Hints, lessons, explanations -- skip this if you understand the code.
- It's modular -- You can add new, delete the useless (to you), & rearrange the presentation order.
- Nicely formatted output.
- You can send the output wherever you want.
- Functions hold repeated code, for:
- less typing.
- modular debugging,
- making changes in one place.
- 2-1/2 uses of braces:
- to enclose the body of a function -- this is the half, it's really a special case of iii)
(see bash man page at "Shell Function Definitions"),
- brace expansion - "{/etc/*{release,version}*,/proc/version}"
(see bash man page at "brace expansion is"),
- Compound Commands - enclosing the body of the functions & enclosing the main line for piping or redirection
(see bash man page at "Compound Commands"),
- "-e" option for echo (man echo)
- "$@" positional parameter (see bash man page at "several parameters specially")
- "-S" option for less (man less)