Simple math statements in bash in a for loop -


I am doing a lot to bash scripting and it is usually to avoid all costs, but I have to write a Bash script to execute a few simple things on a remote cluster. I have a problem for the following loop: {1..20} in <{p>

  i {1..20} E for tax in {1..20} (i * i + j * j) ** 5. & Lt; --- Pseudo code! Done  

Can you help me with this simple math? I have thrown $ everywhere and can not write it properly if you can help me understand how how to designate loops allocated in / bash and interpreted Bash math The limits (how do you square root?) I would be very grateful. Thanks!

Here's a decent solution:

  for i in { 1..20} {1..20} Do the h for "scale = 3; sqrt ($ i * $ i + $ j * $ j)" | BC will output:  
  1.414 2.236 3.162 2.236 [... etc ...]  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -