On 09/26/2016 06:24 AM, Wei Liu wrote:
> On Mon, Sep 26, 2016 at 11:20:50AM +0100, Ian Jackson wrote:
>> Wei Liu writes ("Re: [PATCH v6] acpi: Prevent GPL-only code from seeping 
>> into non-GPL binaries"):
>>> On Fri, Sep 23, 2016 at 03:14:20PM -0400, Boris Ostrovsky wrote:
>>>> +links="ABCD"
>>>> +
>>>> +for i in $(seq 0 3)
>>>> +do
>>>> +    link=${links:$i:1}
>>> This is not portable.
>>>
>>> Use following instead:
>>>
>>> links="A B C D"
>>>
>>> set $links
>>> for link in $@
>> What's wrong with
>>
>>   links="A B C D"
>>
>>   for link in $links; do
>>     ....
>>
>> ?

There are two interdependent variables that I need to print. The C
equivalent is

    for ( i = 0; i < 4; i++ )
        printf("%d %c\n", i, 'A'+i);

The character value is derived from 'i', which in this example is an
index into 'links' array.

I suggested in response to Jan

    link=`echo "A B C D" | cut -d" " -f $i`



-boris


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to