Heres the outout I get when I run the script, I tried adding the say but it produced the same results.
Layer-2 Switch
Line has invalid autocommand "show running-config"
In order for me to execute the show run config I need to get the box into enabled mode. I copied the sequences below from the CLI of me running the commands manually. Hopefully it will help illustrate what I am trying to do.
Switch-01>enable <--- Log on to box and type enable
Password: <---prompts for password
Switch-01#sho run <--- drops into privilege mode where I can run the show run command
Building configuration...
also I was able to get rid of the newline character by adding
chomp ($filename); |