On Fri, Nov 30, 2012 at 5:32 AM, John Horne <john.ho...@plymouth.ac.uk> wrote:
> On Thu, 2012-11-29 at 18:56 -0600, inode0 wrote:
>
>>
>> Oh, for a simple variable this should work
>>
>> echo "${XX/*
>>
>> }"
>>
> Hello,
>
> Yes, that does seem to work :-)
>
> Although I have to admit I'm not sure why! I'll investigate further :-)

Basically it just drops the longest substring that matches the given
pattern (match anything followed by two newlines). This does
potentially miss some edge cases if you can have strings containing
only a single leading or possibly trailing blank line. But you can
remove leading and trailing blank lines if necessary or come up with
something more clever. See the "Parameter Expansion" section of the
bash man page for the details of this and other frequently useful ways
to expand/modify variables.

John
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to