I have a variable setup like this:
SSH_EXEC="ssh -X -o ControlPath=~/.ssh/master-$$ -o ControlPersist=60"
The parameter in question is the -X
, because if I then call this command within my local script
$SSH_EXEC user@server "./server_script.sh $aFile"
which in a nutshell does the following:
if [ -e /path/"$1".name ] || [ -e /path/"$1" ]
then
do something
else
error
echo "/path/"$1".name"
exit
fi
Everything works! But if I replace -X
with -t
, my server_script
fails to the else
on the test. I'd prefer not use x11, but I'm not sure what the difference is that is causing it to fail in one instance, and pass in the other.
EDIT
So I just did more troubleshooting and decided to echo the value of /path/$1.name
on the server and it is garbled junk. If my $aFile
name happened to be hello.name
the result of the echo shows .nameello
and also rids the beginning of the path when I use -t
in place of -X
.
What could be causing the corruption of my variables?
xxd
or similar?xxd
is, could you elaborate?^H
(backspace) would delete the characters before it in shell output. Would be visible in a hex dump. In this case, my psychic powers tell me it's a^M
(Carriage return) at the end of$aFile