在 Bash
中,如果我按两次 Tab 键,则会看到:
Display all 1092 possibilities? (y or n)
片段:
! diff ifconfig mount.fuse rcsdiff tiff2pdf
./ diff3 ifdown mount.ntfs-3g rcsmerge tiff2ps
: diffutils-cmp ifenslave mount.ntfs-fuse rdisc tiff2rgba
GET diffutils-diff iftop mountpoint rdjpgcom tiffcmp
HEAD diffutils-diff3 ifup msgattrib read tiffcp
MAKEDEV diffutils-sdiff ifup-local msgcat readelf tiffdiff
POST dig igawk msgcmp readlink tiffdither
[ dir igd-client msgcomm readonly tiffdump
--More--
我认为,如果我搜索 $PATH
环境变量中目录中的所有可执行文件,那么将会生成一个与 more
数据匹配的单列列表> 显示。
这是我的第一次尝试:
echo $PATH | sed -e 's/:/ /g' -e "s/^/find / " | sh > commandlist.txt
wc -l commandlist.txt
1114 commandlist.txt
所以我添加了 -xtype f
和 -perm/u=x
但仍然没有得到 1092:
echo $PATH | sed -e 's/:/ /g' -e "s/^/find / " -e "s/$/ -xtype f -perm \/u=x/" | sh | wc -l
1107
Bash 中的双 Tab 键按下
如何生成其总“可能性”值?
最佳答案
这似乎有效:
compgen -cab | sort | uniq | wc -l
在我的机器上,它显示的数字与选项卡完整的数字相同。
关于linux - 无法将程序与按双 Tab 键时的 Bash 总数相匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9446648/