zoukankan      html  css  js  c++  java
  • find命令扩展

    1.1 方法一   |xargs

    通过|xargs将前面命令的执行结果传给后面。

    [root@znix ~]# find /clsn/ -type f -name "*.sh" |xargs ls -l

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/test/del.sh

    -rw-r--r--. 1 root root 8 Aug 17 19:35 /clsn/test.sh

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/t.sh

    1.2 方法二   $()

    $()先运行里面的命令,把显示到屏幕上的结果留下来

    [root@znix ~]# ls -l $(find /clsn/ -type f -name "*.sh")

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/test/del.sh

    -rw-r--r--. 1 root root 8 Aug 17 19:35 /clsn/test.sh

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/t.sh

    1.3 方法三   -exec {} ;

    -exec 是find 里面自带参数,{}表示find命令找到的文件

    [root@znix ~]# find /clsn/ -type f -name "*.sh" -exec ls -l {} ;

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/t.sh

    -rw-r--r--. 1 root root 8 Aug 17 19:35 /clsn/test.sh

    -rw-r--r--. 1 root root 7 Aug 17 17:00 /clsn/test/del.sh

  • 相关阅读:
    UVa 10055
    UVa 401
    c++中文件应用的一点小变化
    poj2136
    UVa 494
    一台电脑接两个显示器,双屏显示介绍zz
    学习jquery合集
    解决Windows下MinGW显示乱码zz
    QWS_MOUSE_PROTO该如何写
    Qt/e中鼠标设备分析
  • 原文地址:https://www.cnblogs.com/liuyuanq/p/9695715.html
Copyright © 2011-2022 走看看