title: function to modify bash command based on condition
body: <p>The current state of the function is like:</p>
  <pre><code>function git() {
      if  [[ $@ =~ ^&quot;d untrack-all&quot; ]]
      then
          echo &quot;g d rm --cached -r ~&quot;
      elif [[ $@ =~ ^&quot;d add-and-commit&quot; ]]
      then
          echo &quot;g d add ~ &amp;&amp; g d commit -am \&quot;$_\&quot;&quot;
      elif [[ $@ =~ ^&quot;d sb&quot; ]]
      then
          echo &quot;git d branch | rofi -dmenu | xargs git checkout&quot;
      elif [[ $@ =~ ^&quot;d stash-and-reset&quot; ]]
      then
          echo &quot;git d stash &amp;&amp; git d reset --hard HEAD&quot;
      elif [[ $@ =~ ^&quot;d last&quot; ]]
      then
          echo &quot;git d --no-pager log -1 --oneline&quot;
      else
          echo $0&quot; &quot;$@
      fi
  }
  </code></pre>
  <p>What I am expecting is,</p>
  <p>if I run the command <code>git d untrack-all</code> it will actually run <code>g d rm --cached -r ~</code>
  if I run the command <code>git d add-and-commit</code> it will actually run <code>g d add ~ &amp;&amp; g d commit -am \&quot;$_\&quot;</code>
  ...
  If the pattern does not match, it will run the command as it is. For example, if I run <code>git status</code>, it will run <code>git status</code>.</p>
  <p>In the given codem If I replace <code>echo</code> with <code>eval</code>, it closes the terminal. What should I do?</p>