|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc. |
![]() |
|
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
On Fri, 06 Nov 2009 09:56:01 +0000, TaraIkeda wrote:
> Well why use commandline when both Ubuntu and openSUSE offer a gui to > identify the version? Probably because the OP's writing a script and GUIs are notoriously bad for inclusions in scripts used to automate things. ;-) Jim -- Jim Henderson openSUSE Forums Moderator |
|
||||
|
On Fri, 2009-11-06 at 09:36 +0000, freefox wrote:
> Are there some command line tool that shows distro and version of > distro? > > I would like to > > Code: > -------------------- > #!/whatever shell > if (opensuse) > # stuff > elseif (ubuntu) > # other stuff > endif > -------------------- > > Code:
vers=`cat /etc/*elease` if echo "$vers" | grep 'openSUSE' >/dev/null 2>&1; then ostype="OpenSUSE" elif echo "$vers" | grep 'SUSE' >/dev/null 2>&1; then ostype="SUSE" elif echo "$vers" | grep 'Red Hat' >/dev/null 2>&1; then ostype="Red-Hat" elif echo "$vers" | grep 'Fedora' >/dev/null 2>&1; then ostype="Fedora" elif echo "$vers" | grep 'Ubuntu' >/dev/null 2>&1; then ostype="Ubuntu" elif echo "$vers" | grep 'CentOS' >/dev/null 2>&1; then ostype="CentOS" fi |
|
||||
|
I like
Code:
grep -i 'openSUSE'; Code:
grep 'openSUSE' >/dev/null 2>&1; Code:
for string in 'openSUSE' 'SUSE' ... do done
__________________
Henk van Velden |
|
|||
|
Code:
dmesg | grep -i "linux version" |
|
||||
|
Quote:
I wanted to use the -q option to avoid any output and thus avoid to redirect it to /dev/null Code:
grep -q
__________________
Henk van Velden |
|
|||
|
Thanks a lot to all of you.
Now I've got what I need. /freefox
__________________
| openSUSE 11.2 | gnome | laptop: asus x5dij | intel core 2 duo t5900 | 64 bit | screen: 15,6" WXGA Glare LED (1366x768) | graphic: Intel GMA 4500 | HSDPA USB modem - HUAWEI E220 | |
|
||||
|
kernelcruncher@openSUSE-11:~> cat /etc/SuSE-release
openSUSE 11.2 (i586) VERSION = 11.2 kernelcruncher@openSUSE-11:~>
__________________
Box: openSUSE 11.2 | (KDE4.3.3) | M2N4-SLI | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM Lap: openSUSE 11.2 | Celeron 550 | (KDE4.3.3)"3" | Intel 965 GM | Lenovo R61e | 3GB RAM |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|