我试图在终端中显示文件的每一行,但输出始终是:
cat $ file
这是我的代码:
#!/bin/bash
file="users.csv"
IFS=''
echo "bobama, Barack Obama" > $file
echo "gbush, George Bush" >> $file
for line in `cat $file`;
do
echo $line;
done
答案 0 :(得分:0)
我用'cat $file'
替换$(cat $file)
解决了这个问题。
您可以在此处找到更好的解释: Why can't you use cat to read a file line by line where each line has delimiters