zoukankan      html  css  js  c++  java
  • Linux command

    标准错误输出的重定向方法:

    方法一:
    [root@localhost text]# cat linuxde.net 2> out.txt  //没有任何错误提示,正常运行。
    方法二:
    [root@localhost text]# cat linuxde.net &> out.txt
    

    因为错误信息被保存到了out.txt文件中。

    [root@localhost text]# cat linuxde.net 2> /dev/null
    

    将错误输出丢弃到/dev/null中,/dev/null是一个特殊的设备文件,这个文件接受到任何数据都会被丢系,通常被称为位桶、黑洞。

    有时需要检查一组命令花费的时间,举例:

    #!/bin/bash
    
    start=$(date +%s) 
    cat linuxde.net
    
    end=$(date +%s) 
    difference=$(( end - start )) 
    echo $difference seconds.
    

      

  • 相关阅读:
    SpringMVC
    spring-02
    spring-01
    适配器模式
    状态模式
    抽象工厂模式
    观察者模式(发布-订阅模式)
    建造者模式(生成器模式)
    外观模式
    迪米特法则
  • 原文地址:https://www.cnblogs.com/beidongxing/p/7132007.html
Copyright © 2011-2022 走看看