当我在控制台中按下Tab键时,会得到以下输出:
显示所有2957个可能性?(是或否)
有没有办法在这2957个可能性上使用grep命令?我想要搜索所有包含单词"svn"的命令。
显示所有2957个可能性?(是或否)
有没有办法在这2957个可能性上使用grep命令?我想要搜索所有包含单词"svn"的命令。
compgen
命令。要从通过$PATH
可访问的所有命令和命令别名中grep 'svn',请键入。compgen -ac | grep svn
ecrypt
开头的所有命令)吗?使用正则表达式。compgen -ac | grep "^ecrypt"
compgen
。compgen -ac | grep "svn"
for x in `echo $PATH | sed 's/:/ /g'`; do ls $x | grep svn; done
for i in $(echo $PATH | tr ":" "\n"); do find $i -type f -perm +111; done | grep svn
{,.}*svn*
,例如ls -l /usr/bin/{,.}*svn*<tab>
。ls -d ${PATH//:/\/*svn* } 2>/dev/null
${VAR//pattern/replace} replaces in VAR pattern with replace. // is used to replace every pattern, not just the first, which would be just /.