Multiple command for bash shell script [duplicate]

与世无争的帅哥 提交于 2019-12-12 01:57:23

问题


I want to assign a variable after executing the set of commands The first command is to get into the shell of the openshift pod. Then cat a file and assign that to a variable outside the openshift container.

I tried it like this

check=$(oc rsh pod << EOF
cat /var/lib/jenkins/.ssh/check.pub
EOF)

It gives me an error

bash: warning: here-document at line 41 delimited by end-of-file (wanted `EOF')

回答1:


I believe the second EOF needs to be on a line by itself:

check=$(oc rsh pod << EOF 
cat /var/lib/jenkins/.ssh/check.pub 
EOF
)


来源:https://stackoverflow.com/questions/44030479/multiple-command-for-bash-shell-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!