shell exec命令执行shell打印输出到一个文件


[root@master ~]# cat 1.sh 
#!/bin/bash

exec 1>> /tmp/2.log 2>>/tmp/2.log
date 
echo 111
ldkkdfkslfds
date
[root@master ~]# ./1.sh 
[root@master ~]# cat /tmp/2.log 
Sat Jun  9 15:08:19 UTC 2018
111
./1.sh: line 6: ldkkdfkslfds: command not found
Sat Jun  9 15:08:19 UTC 2018
Sat Jun  9 15:10:39 UTC 2018
111
./1.sh: line 6: ldkkdfkslfds: command not found
Sat Jun  9 15:10:39 UTC 2018

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM