【发布时间】:2019-11-16 04:37:36
【问题描述】:
我的 bash 脚本中有以下一行:
echo "foo" | awk -F"=" '{char=system("echo $1 | cut -c1");}{print "this is the result: "$char;}' >> output.txt
我想使用 awk 打印“foo”的第一个字母,这样我会得到:
this is the result: f
在我的输出文件中,但相反,我得到:
this is the result: foo
我做错了什么? 谢谢
【问题讨论】: