Bash script reading input in loop -


i want read bash script

e.g

test.sh input1 id1 name1 input2 id2 name2 input3 id3 name3 

i want read input loop , assign group of 3 parameters local variable , run different command e.g

for var in "$@"            input=$var     id=$var+1     name=$var+2     rawfastq=${input}      echo "input is" $input      echo "id" $id      echo "name is" $name    rscript "$input"/script1.r id name  done 

how go next command line parameter. $var+1 or adding counter , doing ${i+1} doesn't work?

you've got iterate on elements of user's parameters, in other programming language. example:

args=("$@") i=0 while [ $i -lt ${#args[@]} ];   input=${args[$i]}   i=$[$i+1]   id=${args[$i]}   i=$[$i+1]   name=${args[$i]}   i=$[$i+1]    rscript $input/script1.r $id $name done 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -