我有以下命令:
egrep -e "\\\\" pom.xml | egrep -v -e "\\\\$"
我想将它分配给一个变量,以便我可以在以后的代码中回显它:
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
答案 0 :(得分:2)
POM_ERRORS=$(egrep -e "\\\\" pom.xml | egrep -v -e "\\\\$")