我使用python脚本执行shell命令。这是命令:
ntpservlist=( $OMC_NTPSERV ) && IFS=',' read -ra ntplist <<< "$ntpservlist" && for i in "${ntplist[@]}" ; do echo "server $i" >> /etc/inet/ntp.conf ; done
使用脚本执行命令时,会出现以下错误:
^{pr2}$但是如果我使用命令行执行同一个命令,它会正确执行而不会出现任何错误。在
我用的是:
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
执行命令。在
您的交互式shell是}使用的系统shell是
bash
,但是{ksh
的风格。要使用bash
,请使用executable
选项:大多数命令似乎是有效的},用于填充数组。在
ksh
,但一个区别是,read -A
,而不是{相关问题 更多 >
编程相关推荐