[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6] acpi: Prevent GPL-only code from seeping into non-GPL binaries
On Mon, Sep 26, 2016 at 08:58:00AM -0400, Boris Ostrovsky wrote: > 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` > Oh, two variables. Then you could also do: link=`echo $i | tr "1234" "ABCD"` (cut and tr are both from coreutils, so I think we're fine with using either of them) Anyway, enough of discussion about shell script. Pick the method you like. :-) Wei. > > > -boris > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |