grep -R? - Linux

Table of Contents

[root@localhost boot]# ls

config-2.6.29.4-167.fc11.i686.PAE lost+found
config-2.6.30.9-99.fc11.i686.PAE System.map-2.6.29.4-167.fc11.i686.PAE
efi System.map-2.6.30.9-99.fc11.i686.PAE
grub vmlinuz-2.6.29.4-167.fc11.i686.PAE
initrd-2.6.29.4-167.fc11.i686.PAE.img vmlinuz-2.6.30.9-99.fc11.i686.PAE
initrd-2.6.30.9-99.fc11.i686.PAE.img
[root@localhost boot]# grep -R 10 *.lst

grep: *.lst: 沒有此一檔案或目錄
[root@localhost boot]#

=====================在boot 目錄下以遞迴方式 用grep搜尋 "10"這個字串 說找不到


[root@localhost boot]# cd grub
[root@localhost grub]# grep 10 *.lst
timeout=10
[root@localhost grub]#

其實明顯的在grub目錄下 有內容為10的這個字串

這是bug嗎 還是我有哪裡用錯呢??

--

All Comments

Genevieve avatarGenevieve2009-12-11
感覺應該是-R只能接資料夾
用看看find -name '*.lst' -exec grep 10 {} +
Sierra Rose avatarSierra Rose2009-12-13
grep -R -e '10' *.lst
Anthony avatarAnthony2009-12-15
grep -R -e '10' */*.lst 這樣才對
Daph Bay avatarDaph Bay2009-12-15
*/* 是指path的意思嗎 抱歉問題很笨XD
Joe avatarJoe2009-12-15
不過我手邊的書就直接是這樣打耶 grep -R String *.*
Mason avatarMason2009-12-18
hmm 我打*/*是假裝知道grub.conf在第幾層了 還是失敗 XD
*.lst
Ida avatarIda2009-12-21
regular expression *代表出現0次或無限多次的所有字元
Aaliyah avatarAaliyah2009-12-24
但比較奇怪是說 為什麼不打*就好
Kumar avatarKumar2009-12-27
還是這樣只代表搜尋兩層 不是所有層都可以搜尋到呢
Caitlin avatarCaitlin2009-12-28
是因為先被bash 展開 *.lst
Frederica avatarFrederica2010-01-01
find . -type f -name '*.lst' -exec grep 10 {} \;