Bash 定义EOF时出错
我很难使用这个bash脚本,因为它一直在工作,但是自从我重构之后,我就开始使用comling,因为我使用的是EOFBash 定义EOF时出错,bash,shell,Bash,Shell,我很难使用这个bash脚本,因为它一直在工作,但是自从我重构之后,我就开始使用comling,因为我使用的是EOF #!/bin/bash -v get_aws(){ cd /home/ec2-user/ wget https://repo/aws_git chmod 600 aws_git wget https://repo/aws_config
#!/bin/bash -v
get_aws(){
cd /home/ec2-user/
wget https://repo/aws_git
chmod 600 aws_git
wget https://repo/aws_config
yum install -y expect
secret="aws_config"
pass=$(cat $secret)
eval $(ssh-agent)
/usr/bin/expect<<EOF --> this is the line that complain
spawn ssh-add aws_git
expect "Enter passphrase"
send "$pass\r"
expect eof
spawn git clone git@github.repo.git
expect "Are you sure you want to continue connecting"
send "yes\r"
expect eof
EOF
echo "finish" --> this line it colored as it was all String
}
get_aws
#/bin/bash-v
get_aws(){
cd/home/ec2用户/
wgethttps://repo/aws_git
chmod 600 aws\u吉特
wgethttps://repo/aws_config
yum安装-y预期
secret=“aws\u config”
通过=$(类别$机密)
eval$(ssh代理)
/usr/bin/expect这条线是彩色的,因为它都是字符串
}
获得
错误显示第13行由文件结尾分隔(预期为“EOF”)
有什么想法吗?我看不出这个错误
问候
-选项标记此处文档限制字符串(
-选项标记此处文档限制字符串(把一个
-
放在之间不,同样的问题,但是谢谢你用空格来缩进吗?然后你必须把它移到行的开头来取消你的定界EOF
。是的,那就是问题所在!非常感谢,我完全忘记了在EOF里面它被当作字符串放在-
之间不,山姆e问题,但是谢谢你用空格缩进吗?那么你必须通过把它移到行的开头来取消你的定界。是的,这就是问题!非常感谢,我完全忘记了在EOF里面它被当作字符串处理