cat和echo疑问
写了个小脚本如下:
- Python code
#!/bin/bash phrase_file=/home/hadoop/phrases.txt for content in `cat ${phrase_file}` do phrase=`[b][color=#FF0000]cat ${content}[/color][/b]| awk 'BEGIN{FS=";"}{print $1}'` done
phrases.txt文件格式如下:
A previous rep told me;1280
照理说代码是ok的,但调试结果是这样:
+ for content in ‘`cat ${phrase_file}`’
++ cat A
++ awk ‘BEGIN{FS=";"}{print $2}’
我估计红色粗体地方的问题,我试图用phrase=`echo ${content} | awk ‘BEGIN{FS=";"}{print $1}’`来解决,结果不行.phrase=`> ${content} | awk ‘BEGIN{FS=";"}{print $1}’`也不行,请问是怎么回事呢?
哪里有echo的事情
cat是打印文件,你cat $content是干嘛?
用echo