Get environment (windows or unix) using jython

how to find out if the environment is windows or unix. I want to execute the same code as below. Please suggest

import os
if (os.getenv("windows"):
    os.system(cmd/c ...)

if (os.getenv("unix")
    os.system(sh shellscript.sh)

Thank you for your help.

+3
source share
1 answer

Use System.getProperty to get the os.name property.

>>> import java.lang.System
>>> java.lang.System.getProperty('os.name')
u'Mac OS X'
+1
source

Source: https://habr.com/ru/post/1749400/


All Articles