command > file:将输出重定向到file
command >> file:将输出以追加的方式重定向到file
说明:上述命令的意思是执行command然后将输出的内容存入到file(覆盖还是追加由> 和 >> 决定)
[root@ipha-dev71-1 exercise_shell]# echo 1 > test.sh [root@ipha-dev71-1 exercise_shell]# cat test.sh # 查看文件内容 1 [root@ipha-dev71-1 exercise_shell]# echo 2 >test.sh [root@ipha-dev71-1 exercise_shell]# cat test.sh 2 [root@ipha-dev71-1 exercise_shell]# echo 3 >> test.sh [root@ipha-dev71-1 exercise_shell]# cat test.sh 2 3
command < file:将输入重定向到file