Need expect to read variables from a list while logged into the same device
Hi,
I'm primarily a Cisco/Juniper networking guy, so you'll have to forgive my ignorance when it comes to scripting (although I do write simple backup scripts and things of that nature on a regular basis and I run Linux at home, so I am vaguely familiar with it). What I need to do should be fairly simple, but I can't find much on how to do it (either that or I need to get better at describing my problem when searching). I have seen tons of tutorials on the Internet on how to have expect loop through a list of IP addresses for different devices, logging in and issuing commands in each device along the way. However, what I need to do is issue repetitive commands for different variables in the same device over and over again until finished. (We have an issue wherein we have to delete 100 or so customer configurations out of a device, clear their associated circuit and handle identifiers, and then rebuild them to get them working again). I have most of what I need, I just need to figure out how to integrate the list into the script itself.
I'm pretty sure the "pvc" "circuit" and "handle" parts are wrong and I have to do some sort of "do while" counter thing, but again, I'm still sort of learning this stuff.
Here's an example list for the type of input that $pvc would have:
936:21
936:25
936:28
941:22
Thanks in advance for the help!
Last edited by wolverene13; 05-26-2011 at 10:22 PM..
I was wondering if anyone could provide some assistance. I trying to run an expect script within bash and get the results of a variable called RESULT. I Have tried a few things but none of them have worked. I know that the child process (the expect script) in this instance cannot set a variable... (6 Replies)
Discussion started by: ylafont
6 Replies
2. Forum Support Area for Unregistered Users & Account Problems
I'm getting the following error (or something similar) whenever I try to view a thread when I'm logged in.
That is, I login, hit "New Posts", get a list of theads, click on one (in this example is was the "Not allowed to post URLs" thread), then get the following HTML error page instead of the... (1 Reply)
Hi Guys!
I am sure that this question might appeared previously, but I still don't know how to show a list of logged out users. Please help with this!
Thanks in advance:) (5 Replies)
I'm trying to make an expect function that will pass through a variable.
/usr/bin/expect<<EOD
spawn su -
expect "Password: "
send "$psswd\r"
expect "#"
send "/etc/init.d/network restart >>$log\r"
expect "#"
send "exit\r"
EOD
The $log passes through but my $psswd fails
I know... (1 Reply)
I'm writing a script that'll send a time-stamp to my backup server. I create a file with the name of the current date, send it to my server with scp and rm the file from the local computer.
Individually these commands work fine and with a set name the expect scripts also work fine. The problem... (0 Replies)
I am trying to find a way to list every records inside a file (usually a log file) that are present after a record mathing/greater-then a timestamp supplied by another script.
The timestamp can be anywhere inside the record and it is usually in the standard `date` format (will not look for other... (5 Replies)
How can I get the list of logged in users in the system programmatically?
I can get the list with 'who' or 'users' commands but I need to get the list programmatically...
May someone help, please?
Thanks in advance. (2 Replies)
Hi,
Can I get a script to list out all the users, who has not logged on since last 90 days. Last command in not working due due to /var/adm/wtmpx is more than 2 GB.
Thanks in advance.
Regards,
Roni (10 Replies)
I'm trying to execute a single shell command that will give me a sorted list of all the users currently logged into the system, displaying the users name as it appears in /etc/passwd.
I've tried
awk -F: '{print $1}' /etc/passwd | xargs finger -s | cut -c11-28 | uniq
This list whoever does... (7 Replies)