Unix shell命令的新功能。我需要在當前目錄中回顯名稱不以'cs'開頭的文件。Bash/Shell Echo Globbing Pattern
回答
shopt -s extglob # Enable extended globbing
echo !(cs*)
是這個bash專用? – sehe
@sehe:ksh和zsh以自己的方式支持它。不是關於csh的線索。 –
我正在給你正確的標記,因爲它給了我正確的方向。 更簡單的方法,我只是回聲[!cs] * – bananajunk
find . -maxdepth 1 -type f ! -regex ".*/cs.*"
不會'ls | grep -v'\ .cs $''更簡單嗎? –
它可能會,但它可以匹配其他位,如果'-l'傳遞給'ls'。 –
'-l'不應該是個問題,因爲它是用'$'來錨定的。 '-F'就是了。 –
- 1. Grunt Globbing patterns
- 2. linux globbing庫?
- 3. gitignore globbing或RE?
- 4. 比較兩個存檔文件BashShell
- 5. docker COPY with file globbing
- 6. Perl文件Globbing Oddities
- 7. 如何使用,直到循環讀取文本文件(bashshell)
- 8. Rails 5.1:Globbing不起作用?
- 9. 用symfony原則進行Globbing
- 10. 在PHP中禁用globbing exec()
- 11. CMake globbing生成的文件
- 12. 防止在bash腳本中出現globbing
- 13. Cahining pattern
- 14. 在@Pattern
- 15. 有什麼問題:Pattern pattern = Pattern.compile(「\\」);
- 16. ECHO在ECHO在IF
- 17. Echo裏面和Echo
- 18. 在shell原型中實現globbing
- 19. Gradle Include Pattern
- 20. preg_match url pattern
- 21. Javascript - Module Pattern differences
- 22. Git diff pattern
- 23. python pattern matching numbers
- 24. Texturebrush with separator pattern
- 25. grep multiline pattern
- 26. Segmented Programatically Pattern
- 27. Lua Pattern Exclusion
- 28. IRequest/IResponse Pattern
- 29. UIView bottom egde pattern
- 30. Django url pattern
或者[UNIX和Linux(http://unix.stackexchange.com/)。 –