bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] replace patterns in empty strings


From: isabella parakiss
Subject: Re: [PATCH] replace patterns in empty strings
Date: Thu, 7 May 2015 05:16:10 +0200

Sorry, the previous patch was wrong, it enters an endless loop when
replacing all the occurrencies in ${var//pat/rep}

Attached the correct one (I think).

Tests:
$ ./bash -c 'var=; echo "${var/#/x}"'
x
$ ./bash -c 'var=; echo "${var/*/x}"'
x
$ ./bash -c 'var=; echo "${var//*/x}"'
x
$ ./bash -c 'var=abc; echo "${var/#/x}"'
xabc
$ ./bash -c 'var=abc; echo "${var/*/x}"'
x
$ ./bash -c 'var=abc; echo "${var//*/x}"'
x

This behaviour is consistent with ksh.

Sorry for the trouble...


---
xoxo iza

Attachment: corrected-0001-replace-patterns-in-empty-strings.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]