Script... variables with expect?
Need some help with a script im trying to modify, i "stole" it from ping2tariq here on the forum.
Sad to say my scripting skills arent what they should be.
This is what i want to do: log into a telnet session, run command and save output to file, name that file by todays date/time, save the file on a share.
Heres what i got so far, my problem is the naming, having trouble with the naming of the file. (running it on local machine for testing purpose)
[root@test ~]cat /tmp/test
for i in `cat /tmp/ip`
[root@test ~]cat /tmp/ip
set timeout 30
set machine [lindex $argv 0]
set username user
set password p@ssw0rd
spawn telnet $machine
send "ifconfig > /tmp/$date" <--- want to name this file by date,
#expect "ip:" where and how do i deffine
send "127.0.0.1\n" variable?
Alternativly instead of date i could name it my self, for example if i run ./test <filename> the file will be named <filename>.