Skip to main content

An answer forFor most modern linux-OSLinux OS systems., the file /etc/os-release is really becoming standard and is getting included in most OS. soSo inside your bashBash script youryou can just include the file, and you will have access to all variables described here (egfor example: NAME, VERSION, ...)

soSo I'm just using this in my bashBash script:

if [ -f /etc/os-release ]
then
        . /etc/os-release
else
        echo "ERROR: I need the file /etc/os-release to determine what my distribution is..."
        # ifIf you want, you can include older or distribution specific files here...
        exit
fi

An answer for most modern linux-OS systems. the file /etc/os-release is really becoming standard and is getting included in most OS. so inside your bash script your can just include the file, and you will have access to all variables described here (eg: NAME, VERSION, ...)

so I'm just using this in my bash script:

if [ -f /etc/os-release ]
then
        . /etc/os-release
else
        echo "ERROR: I need the file /etc/os-release to determine what my distribution is..."
        # if you want you can include older or distribution specific files here...
        exit
fi

For most modern Linux OS systems, the file /etc/os-release is really becoming standard and is getting included in most OS. So inside your Bash script you can just include the file, and you will have access to all variables described here (for example: NAME, VERSION, ...)

So I'm just using this in my Bash script:

if [ -f /etc/os-release ]
then
        . /etc/os-release
else
        echo "ERROR: I need the file /etc/os-release to determine what my distribution is..."
        # If you want, you can include older or distribution specific files here...
        exit
fi
Source Link
Chris Maes
  • 3.6k
  • 4
  • 24
  • 33

An answer for most modern linux-OS systems. the file /etc/os-release is really becoming standard and is getting included in most OS. so inside your bash script your can just include the file, and you will have access to all variables described here (eg: NAME, VERSION, ...)

so I'm just using this in my bash script:

if [ -f /etc/os-release ]
then
        . /etc/os-release
else
        echo "ERROR: I need the file /etc/os-release to determine what my distribution is..."
        # if you want you can include older or distribution specific files here...
        exit
fi