title: changing position of character in string bash
body: <p>i have this string</p>
  
  <pre><code>E="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  </code></pre>
  
  <p>any idea how to change the position of the letters with its neighbour if the user enters no</p>
  
  <p>and it will continue changing position until user satisfied with the string OR it has reach end of the string.</p>
  
  <pre><code>is the position of 1st correct? Y/N
  N
  E=BACDEFGHIJKLMNOPQRSTUVWXYZ
  *some of my code here*
  are u satisfied? Y/N
  N
  
  is the position of 2nd correct? Y/N
  N
  E=BCADEFGHIJKLMNOPQRSTUVWXYZ
  *some of my code here*
  are u satisfied? Y/N
  N
  
  is the position 3rd correct? Y?N
  Y
  E=BCADEFGHIJKLMNOPQRSTUVWXYZ
  *some of my code here*
  are u satisfied? Y/N
  N
  
  is the position 4th correct? Y?N
  Y
  E=BCADEFGHIJKLMNOPQRSTUVWXYZ
  *some of my code here*
  are u satisfied? Y/N
  Y
  
  *exit prog*
  </code></pre>
  
  <p>any help will greatly appreciated. thanks</p>
  
  <p><strong>edited</strong>
  i got this code from a forum. worked perfectly. but any idea how to swap next character after it have done once? for example ive done the first position, and i want to run it for the second character? any idea?</p>
  
  <pre><code>dual=ETAOINSHRDLCUMWFGYPBVKJXQZ
  phrase='E'
  rotat=1
  newphrase=$(echo $phrase | tr "${dual:0:26}" "${dual:${rotat}:26}")
  echo ${newphrase}
  </code></pre>