Question: Bash script reading input in loop
0
gravatar for inspiresnehal
2.9 years ago by
inspiresnehal • 20 wrote:

I want to read bash script

e.g

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

I want to read input into loop and assign group of three parameters to local variable and run different command e.g

 

for var in "$@"   
    do
    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 do I go to the next command line parameter.  $var+1 or adding counter and then doing ${i+1} doesn't work?

 

 

bash loop • 801 views
ADD COMMENT • link • modified 2.9 years ago • written 2.9 years ago by inspiresnehal • 20
0
gravatar for Hotz, Hans-Rudolf
2.9 years ago by
Switzerland
Hotz, Hans-Rudolf • 1.8k wrote:

This is not really a Galaxy related question, isn't-it?

So, you might wanna try: http://bfy.tw/3bTj or http://bfy.tw/3bTq   ;)

 

Hans-Rudolf

ADD COMMENT • link written 2.9 years ago by Hotz, Hans-Rudolf • 1.8k
0
gravatar for inspiresnehal
2.9 years ago by
inspiresnehal • 20 wrote:

opps didn't realise I  posted in galaxy only forum..Looks like I cant delete it either....I did try googling the solution ..my case is different from the answers on the google..I don't  have always fixed no of arguments..

ADD COMMENT • link written 2.9 years ago by inspiresnehal • 20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 172 users visited in the last hour