more bash! regex substitution to crop trailing whitespaces
Madison Kelly
linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Tue Dec 18 20:11:27 UTC 2007
Kevin Cozens wrote:
> Madison Kelly wrote:
>> # Leading spaces off of VAL
>> if [[ "$VAL" =~ '(\s+)(.*)' ]]; then
>> {
>> VAL=${BASH_REMATCH[2]};
>> }
>
> You should consider changing the if statement to anchor the pattern
> match to the start of the string.
>
> if [[ "$VAL" =~ '^(\s+)(.*)' ]]; then
>
You are indeed right. :)
Madi
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list