title: How can I properly escape bash variables when being quoted in various ways
body: <p>I have the following code:</p>
  
  <pre><code>set -o xtrace
  openDirectory ()
  {
      lxterminal --command="zsh -c 'cd "$1"; zsh -i' "
  }
  
  # Handle argument.
  if [ "$@" ]
  then
    openDirectory ~/Projects/Clients/"@1"
    cd $1
  fi
  </code></pre>
  
  <p>This fails if there is a space in the argument passed.</p>
  
  <pre><code>lxterminal '--command=zsh -c '\''cd /home/chris/Projects/Clients/Test' - 'Space; zsh -i'\'' '
  cd Test - Space
  cd: too many arguments
  </code></pre>
  
  <p>How can I properly escape this? Is this even feasible to be done with something like bash?</p>