Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Puts output is being shifted to the right ...

Posted by doublea1535 (doublea1535), 2 September 2006
Output from puts is being shifted to the right on my terminal when I run my script. It is being shifted to the right the exact amount of spaces that the last output from puts took up + 1. E.g. (formatting/spaces are not being retained exactly as they show up in my terminal),

---

Port is looped!
Would you like to take the loop <down> it or <exit>?
Sleeping for 5 seconds to let loop drop
                                      Loop has been dropped
                                                           Would you like to <pause> or <exit> or throw a loop <up>?
                                                                                                                    Loop has been thrown up
                                                                                                                                           Would you like to <pause> or <exit> or take the loop <down>?
                                         Sleeping for 5 seconds to let loop drop
                                                                                Loop has been dropped
                                                                                                     Would you like to <pause> or <exit> or throw a loop <up>?
Exiting...

---

Here is a portion of the script that is running.

---

proc loopDown {} {
       global host port modslot
       log_user 0
       send "conf t\r"
       expect "$host\(config)#" { send "controller t3 $modslot\r" }
       expect "$host\(config-controller)#" { send "no t1 $port loopback\r" }
       expect "$host\(config-controller)#" { send "exit\r"; send "exit\r" }
       puts "Sleeping for 5 seconds to let loop drop"; sleep 5
       expect "$host#" { send "show controller t3 $modslot/$port brief\r" }
       expect "Framing" { puts "Loop has been dropped" } "\(ansi)" { puts "Loop is still up!" }
       puts "Would you like to <pause> or <exit> or throw a loop <up>?"
       log_user 1
       interact {
               "pause\r" { puts "Sleeping..."; sleep 6000 }
               "exit\r" { puts "Exiting..."; exit 0 }
               "up\r" { loopUp }
       }
}

---

I did play around with -nonewline and adding more newlines but the behaviour of such was predictable and did not affect the issue. TIA!!!

Posted by admin (Graham Ellis), 2 September 2006
Try adding a \r at the end of your puts commands - I suspect you're just echoing a new line and don't have lf to crlf conversion anywhere.

Posted by doublea1535 (doublea1535), 3 September 2006
That is exactly what it was, thank you again!



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho