Hi !
I am trying to write a wrapper for ssh and it seems that it is not interpreting the arguments that are passed to it. The code for the wrapper goes like :
Code:
invoknam=`basename $0`
function make_command_line_args2 () {
for (( i = 1; i <= $# ; i++ ))
do
eval VAR=\$$i
countargs $VAR
words=$?
if [ "$words" -ge "2" ] ; then
OPTIONS="$OPTIONS \"$VAR\""
else
OPTIONS="$OPTIONS $VAR"
fi
done
echo $OPTIONS
}
cmd2=$(make_command_line_args2 "$@")
echo Command Options : $cmd2
exec /usr/bin/$invoknam $cmd2
but when I execute it it gives
khan /bin> ssh -x "-oForwardAgent no" khan@192.168.0.1
Command Options : -x "-oForwardAgent no" khan@192.168.0.1
ssh: "-oForwardAgent: Name or service not known
So it seems that i am getting the quotes right but they are not interpreted as I want them to. This command is a valid command with normal ssh executable.
Any help will be greatly appreciated ... how can I make this work ? Where am I going wrong ?