我正在尝试使用正则表达式列出文件,但它没有按预期列出。
# ls test*.tgz
test-2012_07_17_11_23_45.tgz
但是当我使用一点钻的正则表达式时,它就失败了。
# ls test-[0-9]{4}_*.tgz
ls: cannot access test-[0-9]{4}_*.tgz: No such file or directory
# ls test-[0-9]\{4\}_*.tgz
ls: cannot access test-[0-9]{4}_*.tgz: No such file or directory
# ls "test-"[0-9]\{4\}"_"*".tgz"
ls: cannot access test-[0-9]{4}_*.tgz: No such file or directory
任何指针都会有所帮助。