So i am wondering. What is expect designed to do? Specifics please.
I have no problems with it, logging into a remote system, or downloading files from a remote site.
But when i try to edit something on a remote system, like creating a file. Nothing.
Example Note $Amount equals a decimal value with no colons or anything.
Code:
/usr/bin/expect - << EndMark
set timeout 1
exp_internal 1
spawn /usr/bin/ssh -f root@ip "/bin/ls /path/ |/bin/grep X_ |/usr/bin/head -n $Amount > /path/test"
sleep 1
expect "root@ip's password:"
sleep 1
send "password\r"
sleep 1
EndMark
But it docent create the file at the remote site.
This is the output i get
Code:
spawn /usr/bin/ssh -f root@ip /bin/ls /path/ |/bin/grep X_ |/usr/bin/head -n 5 > /path/test
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {4060}
expect: does "" (spawn_id exp4) match glob pattern "root@ip's password:"? no
root@ip's password:
expect: does "root@ip's password: " (spawn_id exp4) match glob pattern "root@ip's password:"? yes
expect: set expect_out(0,string) "root@ip's password:"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "root@ip's password:"
send: sending "password\r" to { exp4 }
Why cant it run commands in expect i can run by hand?
Also is their any up-to-date useful expect guides?
Kind regards.