本文介绍了bash shell脚本的多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在执行命令集后分配一个变量第一个命令是进入openshift pod的外壳.然后整理一个文件,并将其分配给openshift容器外部的变量.

I want to assign a variable after executing the set of commandsThe 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.

我这样尝试过

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

这给我一个错误

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

推荐答案

我相信第二个EOF本身需要排成一行:

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
)

这篇关于bash shell脚本的多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 18:59