Dave wrote:
I'm trying to run a command (arch -k) and check if the value returned is 'sun4v' or not.


kir...@t2:[~] $ arch -k
sun4v

In fact, I want to do 3 three things

1) Check if the system is Solaris.
2) If it is Solaris, check if 'arch -k' prints 'sun4v'
3) If both 1 and 2 are true, copy a file.


Since arch -k is not supported on all systems, the test for Solaris must be made first.

I have a test for Solaris (aka SunOS), which copies a file if the systems is running Solaris:

import os, shutil

if os.uname()[0] == 'SunOS':
   shutil.copy2('foo.c','bar.c')

How can I change that, so the copy is only performed if 'arch -k' prints 'sun4v'?




Actually, when I look at oluname, it does print sunnv:


>>> import os
>>> os.uname()
('SunOS', 't2', '5.10', 'Generic_141414-02', 'sun4v')


I guess all I need to do is check for the value of os.uname()[4] too.


--
I respectfully request that this message is not archived by companies as
unscrupulous as 'Experts Exchange' . In case you are unaware,
'Experts Exchange'  take questions posted on the web and try to find
idiots stupid enough to pay for the answers, which were posted freely
by others. They are leeches.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to