|
||||||
| 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 |
|
|||
|
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
__________________
| 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 | |
|
||||
|
Well why use commandline when both Ubuntu and openSUSE offer a gui to identify the version?
|
|
||||
|
Code:
smweb@boven:~> cat /etc/SuSE-release openSUSE 10.3 (i586) VERSION = 10.3 smweb@boven:~>
__________________
Henk van Velden |
|
||||
|
And how is he suposed to use that information in the rest of his script?
__________________
Henk van Velden |
|
|||
|
I tried to illustrate that with my psedo code block.
Depending on distro I would like different things to execute.
__________________
| 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 | |
|
|||
|
Thanks. That solves the suse part. But I would like a more generic solution, telling which distro it is too. suse or ubuntu or ...
More ideas, please.
__________________
| 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 | |
|
||||
|
Not sure there is a more generic though neither am I sure you can just rely on this. cat /etc/*-release really should work but what if for some reason it is empty? Any way this has some and has a few suggestions at some wildcards that may catch most.
release-files |
|
|||
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 If the aforementioned file exists, then SUSE. If not, then test for something Ubuntu-specific. What that is, though, is probably something to be found in an Ubuntu forum. A quick Google search as follows: ubuntu version command line turned up several hits that answered the question (`cat /etc/issue`) which also works on my SUSE box so maybe that is a better distribution-agnostic way to get which distro you are on. Good luck. freefox wrote: > Thanks. That solves the suse part. But I would like a more generic > solution, telling which distro it is too. suse or ubuntu or ... > > More ideas, please. > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJK9BdsAAoJEF+XTK08PnB5xqAP+QGn7fG/1F3j4t9FQrRw60yL CPXizU9whWYICqGbqtfVoKq/F8LN1yv4+2JAwL5vtsVHJZwTZts2oOCDI3ddRZ50 mZuKkFTeTXCWjlsQA1HPvI7I03MZpy69s0Qxsm1Eo8lBIIh/IS2q2fkWuWKnObjt CVNGB317iW0aAato69BfRrMuQcGNfKwMKrnrk9lgo5HRWjOPTp bDwk3QEEYFpv4x oE1j+fZ3xDnGjB7p/VIhHjxVA+hYnk3NL/CGAkz2jlvSfSkHp8DQDK2x1M6omgyB +5yG4xBR+ahMh4PIsuv+xHIOxqtoUWT2AvuEnSMJkW74vz+c3L E2E6/J7qrE+Oaa +GvLh92CaYFYjd3ypxVN9WsNQaqUGfMDjhukHbuZTW6gTXIjKn +Lyu1B3efYdQyo 9LDE6HyRe3uVCTguTDLh/1TG8IgiqfYrKs3o+IYORqUirgyT2+mtXAR86pO6LOv0 vz6mXrTSG5+e66QPyf605AeOSIwmOhZXFL7N0A0ZAWwsBNND82 NlnS6b+0mMS98/ hNJsfyfYHIfQN4j2HX6DcNKiPNw/EtXtvhN7ipuK9kEMc7+4/wEOaTS7/qnXMjm7 hHkZDHydaeTnJWmlA1bH009L/2ZFj6e9/mp8sx1+5lqUNTIiJfwuPo5rm8Eyxbab QnL+1HocqXZOTAZUikqF =gq5k -----END PGP SIGNATURE----- |
|
||||
|
Quote:
Use the lsb_release command eg in my sig I use; Code:
MYSYSTEM=`lsb_release -sd |cut -f2 -d ""\"` Cheers Malcolm °¿° (Linux Counter #276890) SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.37-0.1-default up 3 days 9:12, 2 users, load average: 0.03, 0.09, 0.05 GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18 |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|