我正在尝试使用数组在 3 个远程服务器中执行以下命令集,使用 Here Document,但出现错误
代码 -
ssh -oPasswordAuthentication=no $remoteUser@${SERVER[i]} <<-END_TEXT
VALUE=`cat /home/cognos/cognos/c8/configuration/cogstartup.xml | grep -i xsd:long | head -1 | cut -d">" -f2 | sed 's/[:/<|crn:value]*//g'`
VALUE_BACKUP=$VALUE
........................ (many more lines of code)
RESULT1=`perl -e '@stats = stat("/home/cognos/cognos/c8/configuration/signkeypair"); print ((time - $stats[9]) < '$VALUE');'`
END_TEXT
和错误:
**error -**
syntax error at -e line 1, near "< )"
Execution of -e aborted due to compilation errors.
syntax error at -e line 1, near "< )"
Execution of -e aborted due to compilation errors.
syntax error at -e line 1, near "< )"
Execution of -e aborted due to compilation errors.
ps- 使用 scp 将命令复制到远程服务器,然后使用 ssh 运行它们不是我正在寻找的解决方案。