免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5135 | 回复: 6
打印 上一主题 下一主题

请教compgen命令的用法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-07-08 16:29 |只看该作者 |倒序浏览
看了compgen命令的help和man页,还是不明白这个命令想实现什么样的功能。

论坛徽章:
1
巨蟹座
日期:2014-06-04 13:33:30
2 [报告]
发表于 2009-07-08 16:37 |只看该作者
啥意思?还是不明白这个命令想实现什么样的功能??

root@debian:~/test# apt-cache search compgen
r-base-core - GNU R core of statistical computing language and environment

论坛徽章:
0
3 [报告]
发表于 2009-07-09 09:51 |只看该作者
这个命令有什么功能?怎么使用这个命令呢?

论坛徽章:
9
2015亚冠之阿尔纳斯尔
日期:2015-09-10 16:21:162015亚冠之塔什干火车头
日期:2015-07-01 16:23:022015年亚洲杯之巴勒斯坦
日期:2015-04-20 17:19:46子鼠
日期:2014-11-13 09:51:26未羊
日期:2014-08-28 18:13:36技术图书徽章
日期:2014-02-21 09:30:15酉鸡
日期:2014-01-14 11:12:49天蝎座
日期:2013-12-09 17:56:53平安夜徽章
日期:2015-12-26 00:06:30
4 [报告]
发表于 2009-07-09 10:10 |只看该作者
man compgen

compgen [option] [word]
              Generate  possible  completion matches for word according to the
              options, which may  be  any  option  accepted  by  the  complete
              builtin  with  the exception of -p and -r, and write the matches
              to the standard output.  When using the -F or  -C  options,  the
              various  shell  variables  set  by  the  programmable completion
              facilities, while available, will not have useful values.

              The matches will be generated in the same way  as  if  the  pro-
              grammable  completion  code  had  generated them directly from a
              completion specification with the same flags.  If word is speci-
              fied, only those completions matching word will be displayed.

              The  return  value is true unless an invalid option is supplied,
              or no matches were generated.

论坛徽章:
0
5 [报告]
发表于 2009-07-09 10:14 |只看该作者
就是什么命令 函数补齐把
  1. [root@kenthy ~]# compgen -c 'ls'
  2. ls
  3. lsof
  4. lsmod
  5. lspcmcia
  6. lspci
  7. lsusb
  8. lsinitrd
  9. lspgpot
  10. lsattr
  11. lshal
  12. lsdiff
  13. lsb_release
  14. lspst
复制代码

论坛徽章:
0
6 [报告]
发表于 2009-07-09 10:59 |只看该作者
原帖由 ubuntuer 于 2009-7-9 10:14 发表
就是什么命令 函数补齐把
[root@kenthy ~]# compgen -c 'ls'
ls
lsof
lsmod
lspcmcia
lspci
lsusb
lsinitrd
lspgpot
lsattr
lshal
lsdiff
lsb_release
lspst


这里选项-c是什么意思?如果换成别的选项,好像不是这个效果,而且如果-c后不带参数,效果也不一样。
其中选项-a而且不带参数的情况下,输出结果和用命令alias看到的已存在的别名定义是一致的。如:
  1. root@localhost$ compgen -a
  2. l.
  3. ll
  4. ls
  5. mc
  6. vi
  7. which

  8. root@localhost$ alias
  9. alias l.='ls -d .* --color=tty'
  10. alias ll='ls -l --color=tty'
  11. alias ls='ls --color=tty'
  12. alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
  13. alias vi='vim'
  14. alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
复制代码

论坛徽章:
3
酉鸡
日期:2014-04-23 17:17:56丑牛
日期:2014-05-08 11:41:302015亚冠之德黑兰石油
日期:2015-08-03 11:14:27
7 [报告]
发表于 2014-07-09 16:51 |只看该作者
今天挖坟又挖出个宝贝“命令”
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP