[ipxe-devel] add support for trimming whitespaces from strings

Christian Hesse list at eworm.de
Mon Dec 9 12:02:32 UTC 2013


Michael Brown <mbrown at fensystems.co.uk> on Fri, 2013/12/06 18:28:
> On 29/11/13 11:16, Christian Hesse wrote:
> > some vendors like filling information in BIOS with blanks. So echoing the
> > product variable results in something like "Latitude E6500
> > ".
> >
> > I would like to trim the trailing whitespaces. This is not possible yet,
> > no?
> 
> You can exploit the fact that the shell argument parser will 
> automatically strip whitespace.  For example:
> 
>    # Filter out leading, trailing, and intermediate whitespace from 
> ${product}:
>    set product ${product}

Hmm, this does not work for me. Is this really supposed to work?

iPXE> config [set product to "Test    "]
iPXE> set product ${product}
iPXE> echo +${product}+
+Test    +
iPXE>
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20131209/50b9f287/attachment.sig>


More information about the ipxe-devel mailing list