获取错误/ bin / sh:1:语法错误:“(”意外

时间:2015-06-26 14:12:19

标签: python shell unix

我想从python运行以下脚本:

temp=$(sky2xy image.fits 124.6456 -2.5517); arr=(${temp// / });

为此我使用的是os.system()模块:

import os
os.system('temp=$(sky2xy image.fits 124.6456 -2.5517); arr=(${temp// / });')

但是我收到了意外的语法错误

  

sh:1:语法错误:“(”意外   512

错误是由arr=(${temp// / })

中使用的括号引起的

我应该如何摆脱这个错误?

1 个答案:

答案 0 :(得分:1)

sh: 1: Syntax error: "(" unexpected 512
^^^

/bin/sh/bin/bash(或/usr/bin/bash,视情况而定)不同。您试图在不理解它的shell中使用特定于Bash的语法。

相关问题