title: How to read "variable with backslash from stdin " for bash osx version
body: <p>Yet another question about backslash being eaten up inside bash command/script, when the ultimate goal is to change backslash to forward slash.
  There are several posts about this in stackoverflow. Most suggest using </p>
  
  <pre><code>"read -r"
  </code></pre>
  
  <p>And after playing around with quite a while, I am stuck. I am not sure whether it's a osx issue or bash issue I am hitting up. </p>
  
  <p>However, in my mac bash using the following function </p>
  
  <pre><code>slashme () 
  { 
    read -r varname;
    echo "$varname";
    echo "$1"; 
    x="$(echo "$1" | sed 's.\\.\/.g')"; 
    echo "$x"; 
  }
  </code></pre>
  
  <p>and the following input </p>
  
  <blockquote>
    <p><code>slashme "\\my\\precious"</code></p>
  </blockquote>
  
  <pre><code>&gt; \my\precious
  &gt; 
  &gt; /my/precious
  </code></pre>
  
  <p>What I would expect is following :</p>
  
  <pre><code>\\my\\precious
  
  //my//precious
  </code></pre>
  
  <p>so, what is the magic switch I am missing ?
  I am running
  GNU Bash 3.2.57(1)-release (x86_64-apple-darwin-15)</p>