how can I recognize which OS I am on in a bash script


This question already has an answer here:


There is a standard shell command "uname" which returns the current platform as a string

To use this in a shell program a typical stanza might be


if [ `uname` = "Linux" ] ;
    echo "we are on the operating system of Linux"

if [ `uname` = "FreeBSD" ] ;
    echo "we are on the operating system of FreeBSD"

More specific information is available but unfortunately it varies according to platform. On many versions of Linux ( and ISTR, Solaris ) there is a /etc/issue file which has the version name and number for the distribution installed. So on ubuntu

if [ -e "/etc/issue" ] ;
issue=`cat /etc/issue`
set -- $issue
if [ $1 = "Ubuntu" ] ;
    echo "we are on Ubuntu version " $2

This will give version information

Need Your Help

Need to define a workflow/process that integrates SW dev. all the way through Conf. Management

mercurial process workflow clearcase

We have a group of ~10 devs. who write internal test SW only. Until now, all development has been ad hoc with only a couple developers using Mercurial in their own way. The rest of the people use...

resharper hotkey: subclasses that override certain method


Suppose I select some method and I want to open a tree in which I want to see all subclasses that override this method. What hotkey is used for this in Resharper? In Eclipse I use Ctrl+T for this