[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] bash_completion: improvement, fixes and tests [was: Re: subversion and programmable completion]

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-07-24 07:46:28 CEST

Julian Foad <julianfoad@btopenworld.com> writes:

> But just to > check, try
>
> ~> echo 's/[(,]/\n/g' | hexdump -C
> 00000000 73 2f 5b 28 2c 5d 2f 5c 6e 2f 67 0a |s/[(,]/\n/g.|

$ echo 's/[(,]/\n/g' | hexdump -C
00000000 73 2f 5b 28 2c 5d 2f 5c 6e 2f 67 0a |s/[(,]/\n/g.|
0000000c

> Work-arounds: these all work for me; I'd be interested to know which
> work for you and which don't.

Results below are for sed and tr from the stable Debian distribution.
Looking at the package documentation, the sed info pages and faq both
cover s/// but are worded slightly differently!

> 1. Use "tr" instead of "sed"; unlike sed, its escape sequences are
> explicitly listed in its man page:
> ~> tr --version | head -1
> tr (textutils) 2.1
> ~> echo 'x(y' | tr '(,' '\n'

$ echo 'x(y' | tr '(,' '\n'
x
y

> 2. insert a literal newline character after the backslash, instead
> of 'n'; this is explicitly listed in the manual page:
> ~> echo 'x(y' | sed 's/[(,]/\
> /g'

$ echo 'x(y' | sed 's/[(,]/\
/g'
x
y

> 3. Use numeric escape sequences; these are not mentioned in the
> manual but work for me:
> ~> echo 'x(y' | sed 's/[(,]/\o012/g'

$ echo 'x(y' | sed 's/[(,]/\o012/g'
xo012y

> ~> echo 'x(y' | sed 's/[(,]/\d010/g'

$ echo 'x(y' | sed 's/[(,]/\d010/g'
xd010y

> ~> echo 'x(y' | sed 's/[(,]/\x0A/g'

$ echo 'x(y' | sed 's/[(,]/\x0A/g'
xx0Ay

> Attached is a version of bash_completion_test using "tr", which I
> think is the safest solution. And to keep the patch together, the
> original bash_completion.diff is also attached and the log message
> is repeated here:

Thanks! I checked in a slightly modified version in r6557.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 24 07:47:31 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.