title: Remove a character from the end of a variable
body: <p>Bash auto completion appends a / at the end of a directory name. How I can strip this off from a positional parameter?</p>
  <pre><code>#!/bin/sh
  
  target=$1
  
  function backup(){
    date=`date &quot;+%y%m%d_%H%M%S&quot;`
    PWD=`pwd`
    path=$PWD/$target
    tar czf /tmp/$date$target.tar.gz $path
  }
  
  backup
  </code></pre>