Variables in Telnet
<p>I created a bash script which logs' into a server via telnet. Now I want to <code>cat $var &gt;&gt; /path/on/server/a.log.</code> $var get's specified earlier in the bash script before entering the telnet session. somehow the output <code>"sh: ---------------------------: not found</code>" is created in the telnet session.</p>

<p>I guess that happens because my file.log has multiple lines. the second line is "---------------".</p>

<p>here is my script:</p>

<pre><code>#!/bin/bash
var=$(cat /path/to/local/file.log)
sleep 1
sh &lt;&lt; EOF | telnet 192.168.178.72
sleep 2
echo user
sleep 1
echo pass
sleep 5
# echo "$var" &gt;&gt; /path/on/server/file.log (Can't Test because saving the var is not working)
sleep 5
EOF
</code></pre>

<p>my final goal is to get file.log onto the server. the only way to connect is via telnet. the client doesn't support ssh or rsync or anything.</p>

<p>edit:
more information:</p>

<p>the script doesn'T HAVE to run on the client. I could run it on the server as well. i prefer running the script on the client tho.</p>