代码之家  ›  专栏  ›  技术社区  ›  dacracot

如何为没有.sh后缀的unix脚本配置subversion auto props?

  •  2
  • dacracot  · 技术社区  · 14 年前

    在我的subversion自动道具配置中。。。

    *.sh = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
    

    …而且很有效。但是,我如何配置它来获取没有后缀的shell脚本。

    在我的例子中,它们是我工作区中唯一没有后缀的文件。

    1 回复  |  直到 14 年前
        1
  •  0
  •   Mike Sherov    14 年前

    这个regex应该找到所有没有 . 其中:[^.]*=svn:eol style=native;svn:executable;svn:keywords=“作者日期Id HeadURL修订版”

    这个 glob 应匹配任何包含任意字符数的文件名,后跟任何不是点的单个字符,后跟三个或更多字符。

    *[!\.]??? = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
    

    测试

    我在我的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
    

    注意事项

    如您所见,这只排除了扩展名为3个字符的文件,所以如果您碰巧是c-sharp开发人员(使用 .cs ),或者正在html目录中使用它(使用 .html

    可能的解决办法

    如果你能找到一个地球模式(我不能!)匹配“一个或多个字符”(与 * 匹配零个或多个)或匹配“行尾”的,可以替换 ??? 有了它,glob就可以用于可变长度的扩展。