bash - How the get the length of a vector in a makefile and use it in a for loop? -


how can dimension of vector in makefile? want have simple loop goes through each element of 2 same-sized vectors.

example doesn't work in terms of loop nor size of vectors give idea of thinking about. loop notation taken this:

v1=one 2 3 4 v2=bird stones parks bears print:      size={#$(v1)}      <- invented notation, doesn't work.      i=0      while [[ $$i -le $$size ]] ; \      echo $(v1)[i] $(v2)[i] ; \     ((i = + 1)) ; \ done 

output:

one bird 2 stones 3 parks 4 bears 

i not sure structure fit makefile. think best put loop inside perl script , call perl script makefile. said, here's how write if had write in make + linux way :

v=one:bird two:stones three:parks four:bears print:     @for vv in $(v) ; echo $${vv} | sed 's/:/ /' ; done 

which generates

one bird 2 stones 3 parks 4 bears 

also afaik, line v1=one 2 3 four not create vector. creates string "one 2 3 four".


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -