应该很容易,但想知道为什么使用“左箭头”<
而不是右箭头。
if
fi
done < a.txt
Run Code Online (Sandbox Code Playgroud)
左箭头是什么意思?我想既然我已经完成了条件,输出应该保存在 a.txt 中,并带有右箭头,如 done > a.txt
为什么我们在 if 语句中使用左箭头?
箭头用于重定向:>
重定向输出文件描述符,<
输入文件描述符。
既然你问了很多都是相关的问题,你真的应该看看bash
. 尝试:
man bash
Run Code Online (Sandbox Code Playgroud)