栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

bash:获取以给定字符串开头的命令列表

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

bash:获取以给定字符串开头的命令列表

您应该能够使用 compgen 命令,如下所示:

compgen -A builtin [YOUR STRING HERE]

例如,“ compgen -A Builtin l”返回

let local logout

您可以使用其他关键字代替“ builtin”来获得其他类型的完成。Builtin为您提供Shell内置命令。“文件”为您提供本地文件名等。

下面是操作的列表(从BASH手册页 完整的 ,它使用 compgen ):

  alias      Alias names.  May also be specified as -a.  arrayvar   Array variable names.  binding    Readline key binding names.  builtin    Names  of  shell builtin commands.  May also be specified as -b.  command    Command names.  May also be specified as -c.  directory  Directory names.  May also be specified as  -d.  disabled   Names of disabled shell builtins.  enabled    Names of enabled shell builtins.  export     Names of exported shell variables.  May also be specified as -e.  file       File names.  May also be specified as -f.  function   Names of shell functions.  group      Group names.  May also be specified as -g.  helptopic  Help topics as accepted by the help builtin.  hostname   Hostnames, as taken from the file specified by the HOSTFILE shell      variable.  job        Job  names, if job control is active.  May also be specified as      -j.  keyword    Shell reserved words.  May also be specified as -k.  running    Names  of  running  jobs,  if  job  control  is active.  service    Service names.  May also be specified as -s.  setopt     Valid arguments for the -o option  to  the  set builtin.  shopt      Shell  option  names  as  accepted by the shopt builtin.  signal     Signal names.  stopped    Names  of  stopped  jobs,  if  job  control  is active.  user       User names.  May also be specified as -u.  variable   Names  of  all  shell  variables.   May also be specified as -v.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/412629.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号