linux Shell 命令行-09-redirect 重定向
2018年12月21日大约 1 分钟
拓展阅读
linux Shell 命令行-04-operator 操作符
linux Shell 命令行-05-test 验证是否符合条件
linux Shell 命令行-06-flow control 流程控制
linux Shell 命令行-08-file include 文件包含
linux Shell 命令行-09-redirect 重定向
重定向
命令 | 描述 |
---|---|
command > file | 输出重定向到文件 |
command > file | 输出追加重定向到文件 |
n > file | 文件描述符 n -> 文件 |
n >> file | 文件描述符 n 追加 -> 文件 |
n >& m | 输出文件 m 和 n 合并 |
n ls_file | |
houbinbindeMacBook-Pro:shell houbinbin$ cat ls_file | |
break.sh | |
case.sh | |
continue.sh | |
data.sh | |
diff_demo.sh | |
file_test_oper.sh | |
for.sh | |
funcWithParam.sh | |
funcWithReturnVal.sh | |
function.sh | |
hello.sh | |
hello_name.sh | |
if_else.sh | |
include.sh | |
ls_file | |
num_oper.sh | |
readonly_var.sh | |
special_var.sh | |
test_file.sh | |
test_num.sh | |
unset_var.sh | |
use_var.sh | |
while.sh |
# 输入重定向
我们想计算文件 ```ls_file``` 的行数
```bash
houbinbindeMacBook-Pro:shell houbinbin$ wc -l ls_file
23 ls_file
参考资料
贡献者
binbin.hou