下面是我写的脚本。
#!/usr/bin/expect -f
#!/bin/bash
# connect via scp
Y_DATE=`$(date --date yesterday "+%Y-%m-%d")`
spawn scp /apps/Train/jboss-soa-p.5.0.0/jboss-as/server/default/log/server.log.$Y_DATE "xxxx@Tdev:/apps/software/copiedLogFiles/"
expect "password:"
send "buildadmin\$123\r"
expect "*\r"
expect "\r"
我在执行脚本时遇到错误。
can't read "(date --date yesterday "+%Y-%m-%d")": no such variable
while executing
"Y_DATE=`$(date --date yesterday "+%Y-%m-%d")`"
(file "./copySITtoUAT_CDS.sh" line 6)
我无法弄清楚 Y_DATE 声明中的错误是什么?我在这里错过了什么吗?