On Wed, Jun 24, 2009 at 23:38, Austin English<austinenglish@xxxxxxxxx> wrote: > uname is portable, and should work everywhere. What's *not* portable, > is, e.g., grepping uname for answers, e.g.,: > `uname -a` | grep Linux > Yes, I've seen this done. But what happens if you're on a *BSD box > with the hostname 'Linux_sucks'. > > I meant if you want to do OS specific code paths, use uname -s. I'll try to avoid it in this script.... lsb_release is one of those handy programs that is never installed on a box when you need it... >> (I *know* it works under bash on Solaris, I usually don't bother with >> plain Bourne...) > > Right. I'm not sure where it doesn't work (I'm told Solaris, but > haven't tested). But never hurts to be safe. Normal Bourne is full of #$^#, and every vendor's version seem to have its own quirks... And some replace it with another mostly-compatible shell, like HP-UX's POSIX shell. > >> Somethings that would be nice to add (preferably with a proper option parser): >> Graphics card model / driver detection (Portability might be hard....) > > Not sure how easy that is, tbh. Hmm... Even a card=`lspci | grep 'VGA ' 2> /dev/null` card=${card:-Unknown} might be better than nothing... (But it is UGLY and would probably only work on Linux (that's what the /dev/null is for...)) >> State of common problematic processes, such as pulseaudio / compiz > > Yes, good idea. Preferably with a warning/error if they're enabled. > I don't like grepping ps output though... There must be a better way to check... >> Logged in user (`id` should work..) > > `id` gives a lot more info, e.g., groups a user is in. `whoami` would > be better. Or $USER. > whoami doesn't work on Solaris. "who am i" does work though. id with certain parameters can emulate whoami. (see "whoami --help") I thought the group info might be useful for troubleshooting... >> (I should probably test it on my MacBook and the OpenSolaris box that >> I'm planning to install soon...) > > Good good. The MacBook is still on Tiger and the OpenSolaris box would be at work, which should mean occasional testing, rather than a full test before each release.