[Devel] [PATCH] Using Here-doc instead of echo "..."

Igor M Podlesny openvz at poige.ru
Tue Apr 30 17:39:13 PDT 2013


On 1 May 2013 08:09, Kir Kolyshkin <kir at openvz.org> wrote:
> On 04/30/2013 04:58 PM, Igor Podlesny wrote:
>>
>> -- Here-doc is generally more readable/writeable way to implement
>> "patterns" in SHELL.
>
> indeed
>
[…]
>> -               echo "
>> +               cat >> "$CFGFILE" <<__VENET__
>>   # Auto generated ${VENET_DEV} interface
>
>
> I think you accidentally removed an empty line here.

   Possibly, lemme check.

>>   auto ${VENET_DEV}
>>   iface ${VENET_DEV} inet manual
>> @@ -93,7 +94,7 @@ iface ${VENET_DEV} inet manual
>>         up route add default dev ${VENET_DEV}
>>         down route del default dev ${VENET_DEV}
>>         down ifconfig ${VENET_DEV} down
>> -" >> ${CFGFILE}
>> +__VENET__
>>                 if [ "${IPV6}" = "yes" ]; then
>>                         echo "
>
>
> Overall looks good, although you don't have to have unique identifiers
> for here-doc delimiters, something like EOF should work just fine.

   I prefer self-documented code and here-doc names are good comments actually.

> Also please make sure checkbashism script is OK with your changes;
> one day I found out that it doesn't like delimiters such as -EOF-
> (see commit 845a257).
>
> PS would be great if you next iteration with have v3 added, and

   Will have you meant?

> be a reply to this email, so it's easier to track. Same for other stuff you
> send.

   Actually I tried setting proper reply references, didn't I?

--




More information about the Devel mailing list