How to configure subversion auto-props for unix scripts with no .sh suffix?
Not all of my bas开发者_Python百科h shell script end in .sh. Some have no suffix at all.
In my subversion auto-props configuration I have...
*.sh = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
...and it works. But how can I configure it to also pick up the shell scripts with no suffix.
In my case they are the only files in my workspace that do not have a suffix.
This regex should find all filenames without a .
in them: [^.]* = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
SOLUTION
This glob should match any filename that contains any number of characters, followed by any single character that is not a dot, followed by three or more characters.
*[!\.]??? = svn:eol-style=native;svn:executable;svn:keywords="Author Date Id HeadURL Revision"
TEST
I tested this on my linux box:
[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
As you can see, this only excludes files with the classic 3 character extensions, so if you happen to be a c-sharp developer (uses .cs
), or are using it on an html directory (uses .html
), this won't work.
POSSIBLE WORKAROUNDS
If you can find a glob pattern (I couldn't!) that matches "one or more characters" (as opposed to *
which matches zero or more) or that matches "end of line", you can replace the ???
with that and the glob would work for variable length extensions.
精彩评论