[英]How can I assign the output of this command to a variable in Shell?
I have the following command: 我有以下命令:
egrep -e "\\\\" pom.xml | egrep -v -e "\\\\$"
I want to assign it to a variable so that I can echo it later in this code: 我想将它分配给一个变量,以便我可以在以后的代码中回显它:
egrep -e "\\\\" pom.xml | egrep -v -e "\\\\$" &> /dev/null
if [ $? == 0 ]; then
echo "Errors in POM were found"
echo "line matches (result of the command)"
fi
POM_ERRORS=$(egrep -e "\\\\" pom.xml | egrep -v -e "\\\\$")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.