Oct-20-2018, 09:05 AM
(This post was last modified: Oct-20-2018, 09:54 AM by Gribouillis.)
I recently came across a nice way to convert such scripts: the plumbum module. Using this module, your python code could more or less resemble the following
from plumbum import local, cmd ORACLE_HOME = local.env['ORACLE_HOME'] local.env['PATH'] = "{ohome}/bin:{ohome}/OPatch:{path}".format( ohome=ORACLE_HOME, path=local.env[PATH]) local.cwd.chdir(ORACLE_HOME) cmd.mv('OPatch', 'OPatch.pre6880880') cmd.mkdir('OPatch') osTyp = cmd.uname('-s').strip() if osTyp == 'Linux': cmd.cp( "/gfd/infr/DBA/oracle12102-Linux-X86-64/6880880_zipDir/p6880880_122010_Linux-x86-64.zip", ".") cmd.unzip("p6880880_122010_Linux-x86-64.zip") elif osTyp == 'SunOs': cmd.cp("/gfd/infr/DBA/oracle12102-Solaris64/6880880_zipDir/p6880880_122010_SOLARIS64.zip", ".") cmd.unzip("p6880880_122010_SOLARIS64.zip") else print("!!\n!! unable to determine OS type !!\n!!")