shell腳本 在后台執行de 命令 >> 文件 2>&1 將標准輸出與錯誤輸出共同寫入到文件中(追加到原有內容的后面)


 

命令 >> 文件 2>&1

命令 &>> 文件
將標准輸出與錯誤輸出共同寫入到文件中(追加到原有內容的后面)

# ll >>aaa 2>&1
root@test-W330-C30:~# cat aaa
總用量 3248
drwx------ 18 root root 4096 5月 18 19:35 ./
drwxr-xr-x 36 root root 4096 5月 18 14:41 ../
-rw-r--r-- 1 root root 49 5月 18 19:35 1
drwxr-xr-x 3 root root 4096 3月 22 15:52 3d-haiguang-zhaoxim/
-rw-r--r-- 1 root root 190 3月 22 15:58 3d-haiguang-zhaoxim.zip
drwxr-xr-x 2 root root 4096 5月 4 20:12 aa/
-rw-r--r-- 1 root root 0 5月 18 19:35 aaa
-rw-r--r-- 1 root root 50 3月 31 10:44 .applet
-rw------- 1 root root 23741 5月 18 13:12 .bash_history
-rw-r--r-- 1 root root 3106 10月 23 2015 .bashrc
drwxr-xr-x 2 root root 4096 5月 4 20:12 bb/
drwx------ 6 root root 4096 3月 31 10:44 .cache/
drwxr-xr-x 2 root root 4096 5月 4 20:12 cc/
drwx------ 11 root root 4096 3月 20 19:46 .config/
drwx------ 3 root root 4096 3月 20 19:43 .dbus/
drwxr-xr-x 2 root root 4096 3月 31 10:44 Desktop/
-rw-r--r-- 1 root root 15482 3月 20 19:46 .face
drwx------ 3 root root 4096 3月 20 22:27 .gnupg/
-rw-r--r-- 1 root root 132 3月 20 19:45 history
-rw------- 1 root root 1388 3月 31 10:43 .ICEauthority
-rw-r--r-- 1 root root 0 3月 31 10:43 .instance_kds.lock
-rw-r--r-- 1 root root 3146783 4月 10 09:28 klbios-4.1.4-KL2003251-test-A1927-nologo.fd
-rw------- 1 root root 36 5月 7 16:55 .lesshst
drwx------ 3 root root 4096 3月 20 19:46 .local/
drwx------ 4 root root 4096 3月 31 10:44 .mozilla/
drwx------ 2 root root 4096 3月 20 19:46 .presage/
-rw-r--r-- 1 root root 189 3月 13 22:09 .profile
-rw-r--r-- 1 root root 81 3月 31 10:46 .recentAppLog
-rw------- 1 root root 1024 3月 13 21:58 .rnd
drwxr-xr-x 2 root root 4096 3月 20 19:46 .sogouinput/
drwx------ 2 root root 4096 5月 15 12:35 .ssh/
-rw------- 1 root root 12409 5月 18 13:09 .viminfo
drwxr-xr-x 2 root root 4096 3月 31 10:43 .vnc/
-rw------- 1 root root 967 5月 18 19:35 .Xauthority
drwxr-xr-x 2 root root 4096 3月 20 19:46 桌面/
root@test-W330-C30:~# ll >>aaa 2>&1


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM