0
I am having problem with the following command:
echo "Pass for router:"
read -s pass
/usr/bin/expect - << EXPCT
spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt
#echo @pass
expect -timeout 10000 "password: "
send -- "$pass\n";
expect "#"
interact
EXPCT
this returns:
Pass for router:
spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt
root@192.168.10.1's password:
ash: opkg list-installed: not found
spawn_id: spawn id exp6 not open
while executing
"interact"
problem is that when I use a manual:
ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt
it works flawlessly. Some other points:
'opkg list-installed' > list-installed.txt
doing it that way it successfuly run the command opkg list-installed in the REMOTE machine and saves the result in the LOCAL machine. it's the only way that it works like that. If I login with SSH and then try to do that command it doesn't work, or if it works it saves in the remote path.
yes this works. I was trying to avoid having to install sshpass, but after a lot of time lost I believe it's the way to go. – FernandoSBS – 2013-11-17T19:24:35.677