Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Feb 25, 2009, 15:03 UTC
- Message-ID
- <49A55DAD.2000309@viscovery.net>
- In-Reply-To
- <49A556D5.7020806@drmicha.warpmail.net>
Michael J Gruber schrieb:
Show 7 quoted lines
> Johannes Sixt venit, vidit, dixit 25.02.2009 15:06: >> I think we have so far avoided \+ in sed expressions for portability reasons. > > Hmmpf. Is it that new, or gnu specific? I'm always afraid of portability > issues with bash but wasn't aware of sed being an issue as well. > > In any case, would 's|\\*|/|g' be better (more portable) then?
You mean 's|//*|/|g'; yes, that is definitly portable.
Show 6 quoted lines
> Well, how is > > echo a/b/c/../../d | sed -e ':start;s|\([^/]*\)/\.\./||g;tstart' > a/d > > I meant: how portable is...
I don't know... Let's see: My AIX 4.3.3 sed understands it if it is not all on a single line, and that says a lot. Specifically, I tried this:
echo a/b/c/../../d | sed -e ':start
s|\([^/]*\)/\.\./||
tstart
'and got the desired result:
a/d
Note that the 'g' flag is not necessary in this case.
OTOH, this sed doesn't understand #comments :-/
-- Hannes