PuppyThis forum is for the discussion of Puppy Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
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?
Ok, so you are concerned about the presence or absence of a command? If so, the normal approach is normally testing for the existence (and possibly behaviour) of that command, not trying to determine the exact operating system version. If you tell us what you are actually trying to achieve, and then ask related questions, I think you'll probably get more useful answers.
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.
No need to make a script. It has already been done.
One of us is misunderstanding what the OP is trying to do.
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.
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.
Quote:
Originally Posted by Fixit7
Yes, that is exactly what I would like to do.
For example this works on Puppy but not on other distros.
They probably use poweroff.
???? You just contradicted yourself.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.