2012-01-12 18 views
9

我有一個在我的bash中區分大小寫的目錄列表的問題。例如意外的bash目錄列表*

$ touch nohupa nohuPb 
    $ ls nohup* 
    nohupa nohuPb 

但是,我確實希望它只列出nohupa不nohuPb。因爲nohuPb有大寫P. 我不知道在我的.bashrc集合中哪個變量忽略大小寫。

有什麼想法?

回答

9

這是nocaseglob導致的。

nocaseglob
如果設置,執行路徑擴展當bash匹配的文件名的情況下不敏感 方式(參見上面的路徑名擴展 )。

測試

$ touch fooab fooAb 
$ ls 
fooAb fooab 
$ shopt -s nocaseglob 
$ ls fooa* 
fooAb fooab 
$ shopt -u nocaseglob 
$ ls fooa* 
fooab 
+0

這是正確的。謝謝 – ARH 2012-01-13 02:55:36

2

看起來你的shell具有nocaseglob集。您可以使用稱爲shoptshell built-in取消它。使用-s選項enable it和-u選項disable它。

欲瞭解更多參考,您可以訪問here