bash approach for ease of calling binary with large amount of parameters -


trying figure out best way automate running command takes lot of parameters , changing of them. current approach this:

#!/bin/bash  # 5 more of these value=42 stuff=12 charlie=96  # note these not sequential, bad example param[0]='--oneparameter=17' param[1]='--anotherparam=foo' param[2]='--yetanotherparam=bar' param[3]='--someparam4=314' # above continues 15 parameters or # , ones one: param[16]="--someparam=astring${stuff}.foo" param[20]="--someparam20=filename${value}.foo" 

then call binary:

./mybinary ${param[@]} 

and well.

then change parameter second run:

param[1]='--anotherparam=bar' value=84 # here need include lines depends on value # parameter expansion work param[20]="--someparam20=filename${value}.foo"  ./mybinary ${param[@]} 

this continues 30 runs or so...

the above works it's ugly , error-prone can't figure out better way it! appreciated!

thanks.

if it's small number of parameters change, loop on those.

while read exuberance value attrition attitude spin badness;     ./mybinary --someparam1=17 \             --someparam2="$exuberance" \             --someparam2=bar \             --someparam2="$attrition" \             # :             --someparam20="astring${spin}.foo" \             --someparam20="filename${value}.foo" done <<____here     42 317 xy thirty7 vitamins 117     41 3112 bb virgo pizza 56     41 3113 az virgo pizza 37     69 512 bee ozone onion 99 ____here 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -