[英]How to add REGEX in a string inside a shell script?
以下命令檢測 git 中的任何暫存文件是否為myFile.js
:
echo $(git diff --cached --name-only --diff-filter=ACM | egrep 'path/to/myFile.jsx?$')
但我想檢測該文件夾中的任何.js
文件。 我試過了,但沒有用:
echo $(git diff --cached --name-only --diff-filter=ACM | egrep 'path/to/{*}.jsx?$')
如何在此處為文件名添加通配符?
代替:
egrep 'path/to/{*}.jsx?$'
和:
egrep 'path/to/.+\.jsx?$'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.