zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    服务端配置scan ip
    父表、子表 主外键关系
    Linux下使用NMON监控、分析系统性能
    Spot light工具集
    linux设置中文环境
    【Android Developers Training】 20. 创建一个Fragment
    【Android Developers Training】 19. 序言:通过Fragments构建动态UI
    【Android Developers Training】 18. 重新创建一个Activity
    【Android Developers Training】 17. 停止和重启一个Activity
    【Android Developers Training】 16. 暂停和恢复一个Activity
  • 原文地址:https://www.cnblogs.com/xuanbjut/p/12912604.html
Copyright © 2011-2022 走看看