一.cat的常用用法
1.总结
2.实验
(1).非交互式编辑
[[email protected]~_~ day5]# cat > cattest.sh <<STOP
> hello
> STOP
[[email protected]~_~ day5]# cat cattest.sh
hello
[[email protected]~_~ day5]# cat > cattest.sh << EOF
hello cat with EOF
EOF
[[email protected]~_~ day5]# cat cattest.sh
hello cat with EOF
[[email protected]~_~ day5]# cat > cattest.sh <<~_~
> hdhhdhdhhdhd
> ~_~
[[email protected]~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
(2).清空文件内容
[[email protected]~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
[[email protected]~_~ day5]# cat /dev/null > cattest.sh
[[email protected]~_~ day5]# cat cattest.sh
(3).合并
[[email protected]~_~ day5]# cat > cattest.sh <<EOF
> hello
> EOF
[[email protected]~_~ day5]# cat > cattest2.sh <<EOF
> world
> EOF
[[email protected]~_~ day5]# cat cattest.sh cattest2.sh >newfile.sh
[[email protected]~_~ day5]# cat newfile.sh
hello
world
[[email protected]~_~ day5]# cat newfile.sh
hello
world
二.cat命令常用选项
1.总结