并非我的所有bash shell脚本都以.sh结尾。有些根本没有后缀。
在我的subversion自动道具配置中,我有......
*.sh = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
......它有效。但是我如何配置它以获取没有后缀的shell脚本。
在我的情况下,它们是我工作区中唯一没有后缀的文件。
答案 0 :(得分:0)
这个正则表达式应该找到所有没有.
的文件名:[^。] * = svn:eol-style = native; svn:executable; svn:keywords =“作者日期Id HeadURL修订版“击>
<强>解强>
此glob应匹配任何包含任意数量字符的文件名,后跟任何不是点的单个字符,后跟三个或更多字符。
*[!\.]??? = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
<强> TEST 强>
我在我的linux机箱上测试了这个:
[msherov@*** testmatch]$ uname -a
Linux ***.***.com 2.6.18-53.1.4.el5 #1 SMP Wed Nov 14 10:37:27 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
[msherov@*** testmatch]$ ls -alt
total 8
drwxr-xr-x 2 msherov wheel 4096 Aug 7 08:42 .
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:42 whatever.pp.p
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:42 whatever.bat.p.p
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:39 whatever.bat.php
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:07 omething2
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:06 something
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:06 whatev.jpg
drwx------ 6 msherov msherov 4096 Aug 7 08:06 ..
[msherov@*** testmatch]$ ls -l ./*[!\.]???
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:07 ./omething2
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:06 ./something
-rw-r--r-- 1 msherov wheel 0 Aug 7 08:42 ./whatever.pp.p
<强> CAVEATS 强>
正如您所看到的,这只会排除具有经典3个字符扩展名的文件,因此如果您恰好是一名c-sharp开发人员(使用.cs
),或者在html目录中使用它(使用{ {1}}),这不起作用。
可能的解决方法
如果你能找到一个匹配“一个或多个字符”的glob模式(我不能!)(而不是匹配零或更多的.html
)或匹配“end of line”,你可以用{替换*
,而glob可用于可变长度扩展。