Linux version
I would like my scripts to be able to work with different versions of Linux.
I have Puppy Slacko 5.6 installed, but uname is showing something different. From uname Linux 3.10.5 i686 From Pup Sysinfo. Distro: Slacko Puppy 5.6.0 I also tried cat /proc/version |
uname is showing the kernel version, not the OS version. cat /proc/version also outputs the kernel version.
For example, on my Debian Sid system, uname -a outputs this: Code:
:~$ uname -a In contrast, Code:
~$ cat /etc/*release* |
cat /etc/*release*
gave this: Quote:
|
Within reason it should not matter which kernel version or which distribution or version of that is running for a script to work. But it depends what you want the script to do?
|
Hi,
Quote:
Cheers, Evo2. |
Thanks.
For my needs, it does matter. There are are many distros of Linux. And each of them have different commands. And that is what makes all of them unique. Andy |
Hi,
Quote:
Evo2. |
Quote:
Some Linux distributions have a release file, some have an issue file and some have both. |
# cat /etc/issue
Slacko Puppy Linux Linux 3.10.5 [i686 arch] |
Hi,
once more, do you really care what distro and version your script is running on? There are literally thousands. Please tell us what you are actually trying to achieve and we may be able to help. Evo2. |
Inxi works with different versions of Linux
Code:
# inxi -Fxz Code:
$ inxi -Fxz http://code.google.com/p/inxi/ Install instructions are on that page. It works on everything. |
Hi,
Quote:
As far as I can tell the OP has scripts that (s)he wants to run on different machines. The OP is under the impression that to run these scripts (s)he first needs to determine exactly what OS the script is on. I've tried to point out that trying to determine the OS is neither necessary nor very useful. I think your interpretation of the OP post is that (s)he is trying to write a script that will determine what OS it is being run on. OP: can you _please_ clarify what it is you are trying to achieve. Evo2. |
cat /etc/*release* is a sort of a shotgun of a command loaded with wildcards instead of buckshot.
Most of the time, it hits a target. Sometimes not. |
[QUOTE]
Quote:
For example this works on Puppy but not on other distros. They probably use poweroff. I also run one other distro. Code:
#!/bin/bash |
Hi,
Quote:
Quote:
If you want to know what command to use to shut down a machine, test what commands are available. If instead you try to test for what the OS is you'll need to populate and maintain a database of all possible OSs, and the corresponding commands for each OS. Evo2. |
All times are GMT -5. The time now is 09:56 PM. |