title: Parameter Expansion in Zsh vs Bash: what is the equivalent of "${VAR,,}"?
body: <p>I am trying to perform <a href="https://wiki.bash-hackers.org/syntax/pe#case_modification" rel="nofollow noreferrer">case modification</a> with bash/zsh parameter expansion on macOS (11.4) and making some mistakes. Specifically, I want to take a variable that contains a string and turn it to snakecase (i.e.: from <code>This is a STRING</code> to <code>this_is_a_string</code>). I am taking baby steps and so far I am just trying to turn everything to lowercase and, as far as I understand it, the theory should work like this:</p>
  <pre class="lang-sh prettyprint-override"><code>$ VAR=&quot;StRING&quot;
  $ echo &quot;${VAR,,}&quot; # turn the string characters to lowercase
  string
  </code></pre>
  <p>This did not work at first, because macOS bash is the very much outdated 3.2.57. I installed the current version (5.1.8) with homebrew and it worked.</p>
  <p>Still, this does not work with zsh (most recent version). I guess this happens because parameter expansion is different in zsh, am I right? Still, I cannot find any resourceful reference. I believe that zsh works a bit differently, more like <code>sed</code>. Sure, I could use <code>tr</code> and even <code>sed</code> itself, but I wanted to use parameter expansion.</p>