title: How can I convert a string from uppercase to lowercase in Bash?
body: <p>I have been searching to find a way to convert a string value from uppercase to lowercase. All the search results show approaches of using the <code>tr</code> command.</p>
  <p>The problem with the <code>tr</code> command is that I am able to get the result only when I use the command with the <em><a href="https://linux.die.net/man/1/echo" rel="nofollow noreferrer">echo</a></em> statement. For example:</p>
  <pre><code>y=&quot;HELLO&quot;
  echo $y| tr '[:upper:]' '[:lower:]'
  </code></pre>
  <p>The above works and results in 'hello', but I need to assign the result to a variable as below:</p>
  <pre><code>y=&quot;HELLO&quot;
  val=$y| tr '[:upper:]' '[:lower:]'
  string=$val world
  </code></pre>
  <p>When assigning the value like above it gives me an empty result.</p>
  <p>PS: My Bash version is 3.1.17</p>