bash - recursively append variable to result of curl -
i using curl , putting output file. following script prepends string mystring
output:
#!/bin/bash file=$1 ids=$(head ${file} | awk '{print $1}') in ${ids} curl -ss http://www.uniprot.org/uniprot/$i.fasta -w "mystring" >> test1.txt done
which fine , get:
$ ./myscript.sh mystring>q12345 mystring>p79403 mystring>q27595
however when trying prepend variable doing:
#!/bin/bash file=$1 ids=$(head ${file} | awk '{print $1}') in ${ids} curl -ss http://www.uniprot.org/uniprot/$i.fasta -w "$ids" >> test1.txt done
i get:
$ ./myscript.sh myvar1>q12345 myvar1 myvar1 myvar1 myvar2>p79403 myvar2 myvar2 myvar2 myvar3>q27595 myvar3 myvar3 myvar3
so kind of works - it's adding lines. how should edit script?
curl -ss http://www.uniprot.org/uniprot/$i.fasta -w "$ids" >> test1.txt
should presumably be
curl -ss "http://www.uniprot.org/uniprot/$i.fasta" -w "$i" >> test1.txt
Comments
Post a Comment