不支持管道命令可以通过xargs来提…

会使用xargs的原因是,很多命令其实并不支持管道命令,因此我们可以通过xargs来提供该命令引用standard input之用。
如下:
找出/sbin下面具有特殊权限的文件名,并使用ls -l列出详细属性。
[root@AaronWong shell_test]# find /sbin/ -perm +7000 | ls -l
总用量 108
-rw-r--r--. 1 root root 1411   4月 27 09:57 backup-04-27-2012.tar.gz
-rw-r--r--. 1 root root   127   4月 25 09:20 li2_1.sh
-rw-r--r--. 1 root root   350   4月 25 09:28 li2_2.sh
-rw-r--r--. 1 root root 1442   4月 25 10:37 li2_3.sh
-rw-r--r--. 1 root root   211   4月 25 19:23 li3_1.sh
-rw-r--r--. 1 root root   757   4月 26 21:02 li3_2.sh
-rw-r--r--. 1 root root   381   4月 26 22:24 li3_3.sh
-rw-r--r--. 1 root root   231   4月 27 09:57 li3_4.sh
-rw-r--r--. 1 root root   315   4月 27 12:49 li4_4_int-or-string.sh
-rw-r--r--. 1 root root   531   4月 28 15:59 li4_5.sh
-rw-r--r--. 1 root root   387   4月 28 16:40 li4_6.sh
-rw-r--r--. 1 root root   80   4月 28 16:46 li4_7_shift.sh
-rw-r--r--. 1 root root   93   4月 28 17:05 li5_1_weirdvars.sh
-rw-r--r--. 1 root root   63   4月 28 19:32 li6_1.sh
-rw-r--r--. 1 root root 1156   4月 30 17:06 li7_1.sh
-rw-r--r--. 1 root root   495   4月 30 17:13 li7_2.sh
-rw-r--r--. 1 root root   217   5月   7 10:29 li7_4_broken-link.sh
-rw-r--r--. 1 root root   38   4月 27 11:12 pym.txt
-rw-r--r--. 1 root root   265   4月 26 21:38 test1.sh
-rw-r--r--. 1 root root   38   4月 25 14:24 test2.sh
-rw-r--r--. 1 root root   83   4月 27 10:23 test3.sh
-rw-r--r--. 1 root root   37   4月 27 12:31 test4.sh
-rw-r--r--. 1 root root   103   4月 28 16:08 test5.sh
-rw-r--r--. 1 root root   28   4月 28 19:18 test6.sh
-rw-r--r--. 1 root root   115   4月 30 17:25 test7.sh
-rwxr--r--. 1 root root   168   4月 26 21:51 uppercase.sh
-rwxr--r--. 1 root root   387   4月 28 16:41 wh
结果竟然仅列出了当前目录pwd下的文件,这不是我们想要的。因为ll(ls)并不是管道命令的原因。
[root@AaronWong shell_test]# find /sbin/ -perm +7000 | xargs ls -l
-rwsr-xr-x. 1 root root 119808   4月 20 2011 /sbin/mount.nfs
-rwxr-sr-x. 1 root root   6172   2月 26 2011 /sbin/netreport
-rwsr-xr-x. 1 root root   7700 11月   2 2010 /sbin/pam_timestamp_check
-rwsr-xr-x. 1 root root   30704 11月   2 2010 /sbin/unix_chkpwd


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值