-3

Say I have a Bash loop like this:

declare -a arr=("ALD89117.1" "ALD89128.1" "ALD89126.1")
for i in "${arr[@]}"
do
   echo "myid :" $i
# I want to sleep the process for 0.1 seconds here!!
esearch -db protein -query $i | elink -target nuccore | efetch -format ft

done > >(tee eutils_output.txt) 2>&1

I want to sleep the process in the above loop for 0.1 seconds. What would be the command to do that?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MAPK
  • 5,635
  • 4
  • 37
  • 88
  • 1
    Note that the `$i` dereferences should all be quoted (`echo "myid: $i"`; `esearch -db protein -query "$i"`) to prevent string-splitting and glob expansion from applying; consider running your code through http://shellcheck.net/. – Charles Duffy Oct 29 '18 at 15:58
  • @CharlesDuffy Thank you, I just realized that. – MAPK Oct 29 '18 at 16:09

1 Answers1

2
sleep 0.1

It doesn't get much easier than that!

Thomas
  • 174,939
  • 50
  • 355
  • 478