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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho