2012-02-25 27 views
2

匹配方案,猛砸總在Bash,如果我按tab鍵兩次,然後我看到:無法從雙標籤印刷機

顯示所有可能性? (是或否)

段:

!   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 

如何double tab key press Bash中產生的總 '可能性' 的價值?

+0

我猜想* aliases *和shell * builtins *(如'cd'或'ulimit')也被計算在內...... – 2012-02-25 18:23:47

回答

2

這似乎工作:

compgen -cab | sort | uniq | wc -l 

我的機器上它顯示了相同數量的標籤完整的東西。

+0

+1它也適用於我的。非常感謝你。 – jon 2012-02-25 20:11:13