mkdir -p over SSH bash
<p>I have a small test script as follows;</p>

<pre><code>TESTDIR="$HOSTNAME"
ssh user@server.com "\$TESTDIR"
mkdir -p ~/$TESTDIR/test
exit
</code></pre>

<p>the output with <code>bash -x</code> is;</p>

<pre><code>+ TESTDIR=ndx
+ ssh user@server.com '$TESTDIR'
+ mkdir -p /home/user/ndx/test
+ exit
</code></pre>

<p>Yet on the remote server, no directory exists?</p>