免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2839 | 回复: 5

[Linux] vim 与管道 [复制链接]

论坛徽章:
0
发表于 2012-07-25 21:10 |显示全部楼层
在平常的使用中 常常需要查看一个命令的来源并打开,所以想在一个管道中搞定于是尝试
1.  which fetion.sh | vim -
   不行
2. which fetion.sh | xargs vim
    还是不行
3. vim ` which fetion.sh`
    勉强可以 感觉不爽!
求其它方法! 谢谢!

ps 之前发在系统管理版面,结果石沉大海! 希望这里可以搞定!

论坛徽章:
0
发表于 2012-07-26 10:49 |显示全部楼层
vim ` which fetion.sh` 这个已经挺好了,没必要那么严格吧?

论坛徽章:
24
15-16赛季CBA联赛之北京
日期:2018-08-17 18:43:33技术图书徽章
日期:2018-08-22 12:53:57技术图书徽章
日期:2018-08-22 12:54:20技术图书徽章
日期:2018-08-22 12:54:3015-16赛季CBA联赛之福建
日期:2018-10-19 16:58:1619周年集字徽章-庆
日期:2019-08-27 13:28:5619周年集字徽章-19
日期:2019-08-27 13:31:2619周年集字徽章-19
日期:2019-08-27 13:31:2615-16赛季CBA联赛之同曦
日期:2019-09-05 12:03:2819周年集字徽章-周
日期:2019-09-06 18:54:5415-16赛季CBA联赛之上海
日期:2018-07-25 11:55:2615-16赛季CBA联赛之青岛
日期:2018-07-10 14:13:18
发表于 2012-07-26 14:36 |显示全部楼层
vim ` which fetion.sh`
能用就好.
我的原则就是.如果不考虑性能,就尽量能用就行, 尽量做到可读性好.

论坛徽章:
0
发表于 2012-07-26 18:54 |显示全部楼层
能用是能用,但是心里有疑惑感觉特别的不爽!想着which fetion.sh | xargs vim 应该是可以的,不知道问题出现在哪里? 是bug 还是 我之前的理解有问题?
回复 3# incle


   

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
发表于 2012-07-27 05:23 |显示全部楼层
想着which fetion.sh | xargs vim 应该是可以的,不知道问题出现在哪里? 是bug 还是 我之前的理解有问题?

不是bug  请仔细看 man xargs
  1. NAME
  2.      xargs — construct argument list(s) and execute utility

  3. SYNOPSIS
  4.      xargs [-0oprt] [-E eofstr] [-I replstr [-R replacements] [-S replsize]]
  5.            [-J replstr] [-L number] [-n number [-x]] [-P maxprocs] [-s size]
  6.            [utility [argument ...]]

  7. DESCRIPTION
  8.      The xargs utility reads space, tab, newline and end-of-file delimited
  9.      strings from the standard input and executes utility with the strings as
  10.      arguments.

  11.      Any arguments specified on the command line are given to utility upon
  12.      each invocation, followed by some number of the arguments read from the
  13.      standard input of xargs.  This is repeated until standard input is
  14.      exhausted.

  15.      Spaces, tabs and newlines may be embedded in arguments using single
  16.      (`` ' '') or double (``"'') quotes or backslashes (``\'').  Single quotes
  17.      escape all non-single quote characters, excluding newlines, up to the
  18.      matching single quote.  Double quotes escape all non-double quote charac‐
  19.      ters, excluding newlines, up to the matching double quote.  Any single
  20.      character, including newlines, may be escaped by a backslash.
复制代码

论坛徽章:
0
发表于 2012-07-27 10:43 |显示全部楼层
没看到亮点,请明示!谢谢~~~
回复 5# ulovko


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP