title: embed python in bash script
body: <p>I'm pretty new to python and I'm trying to embed it in a bash script. I have the following bash shell script:</p>
  
  <pre><code>#!/bin/bash
  
  while read line
  do
      ORD=`echo $line | cut -c 1-7`
      if [[ -r ../FASTA_SEC/COMBI_RAW/${ORD}_COMBI_RAW.fa ]]
      then
          touch ../Results/Log_Files/Log_${ORD}.txt
          for (( win = 2; win &lt; 20; win += 2 )); do
              printf 'The value of win is %d, now entereing inner loop\n' "$win"
              for (( per = 50; per &lt; 100; per += 2 )); do
                  printf 'Value of per is %d\n' "$per"
                  WCNO=`grep -o "n\|N" ../FASTA_SEC/COMBI_RAW/${ORD}_COMBI_RAW.fa | wc -l`
                  WCNF=`grep -o "n\|N" ../Results/COMBI/${ORD}_COMBI/${ORD}_w${win}_p${per}_COMBI.fa | wc -l`
                  WCAO=`grep -o "a\|A\|g\|G\|t\|T\|c\|C" ../FASTA_SEC/COMBI_RAW/${ORD}_COMBI_RAW.fa | wc -l`
                  WCAF=`grep -o "a\|A\|g\|G\|t\|T\|c\|C" ../Results/COMBI/${ORD}_COMBI/${ORD}_w${win}_p${per}_COMBI.fa | wc -l`
                  PERN=`echo print ($WCNO-$WCNF)/$WCNO. | python`
                  echo $ORD $PERN
              done
          done
      else
          echo ${ORD}"_COMBI_RAW.fa does not exist"
      fi
  done &lt; ./Data_ORD.txt
  </code></pre>
  
  <p>I would like to carry out this percentage calculation stored in a variable calling python</p>
  
  <pre><code>PERN=`echo print ($WCNO-$WCNF)/$WCNO. | python` 
  </code></pre>
  
  <p>Parenthesis are giving trouble so i get the following output when i run the bash script:</p>
  
  <pre><code>command substitution: line 17: syntax error near unexpected token `('
  command substitution: line 17: `echo print ($WCNO-$WCNF)/$WCNO. | python'
  </code></pre>
  
  <p>Is it something wrong with bash? operation order are defined with parenthesis in python as far as I know.</p>
  
  <p>Thank you,</p>