Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将此命令行插入变量中?:
echo "abc:def" | awk -F':' '{print "field1: "$1 "\nfield2: "$2}'
提前致谢
请试试这个
testVar=`echo "abc:def" | awk -F':' '{print "field1: "$1 "\nfield2: "$2}'` echo $testVar
使用eval:
eval
eval `echo "abc:def" | awk -F':' '{print "export field1="$1 "\nexport field2="$2}'`