vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, have spent some time experimenting with trying to get this to work, but it is still not as I would hope. Currently, my best solution is to execute the echo"\005" command and to configure the answerback string within the emulator to be <variable>=<sting>\n. This gives me a variable I can then export, but I have been unable to suppres the output of the answerback to the terminal. From my stumbling about, it would appear that the response to the echo occurs when the script exits, and this timing has given me the headache. While not fluent in C, I had no more luck with that either. Anyone found a solution, or know of an application/routine that will do this for me? Anyway that I could configure the answerback string to turn output off and then on again? Any other pearls of wisdom would be greatly appreciated. Thanks in advance, Ashley. |
| |||
| ashley.dawkins@blueyonder.co.uk (Ashley Dawkins) writes: >Hi, have spent some time experimenting with trying to get this to >work, but it is still not as I would hope. Currently, my best solution >is to execute the echo"\005" command and to configure the answerback >string within the emulator to be <variable>=<sting>\n. This gives me a >variable I can then export, but I have been unable to suppres the >output of the answerback to the terminal. I don't have a terminal emulator that answers to answer-back requests, so I cannot really test the following code. But, here's what I came up with: #!/bin/ksh # First, memorize current tty settings tty_settings=$(stty -g) # Now, set up a trap to be sure the settings get restored if things # go wrong. trap "stty $tty_settings" 0 1 2 3 # Turn off echoing of answer-back from terminal stty -echo # Load answer-back request sequence into a temp variable. # (For my testing, I used <bell> instead, and manually responded when I # heard the bell.) b=$(print -n "\007") # Now, send the request as a prompt and read the result into foo read foo?"$b" # Restore tty settings stty $tty_settings # Undo our trap trap '' 0 1 2 3 # Do whatever you want with the result echo "Got <$foo>" -- Dale Talcott, IT Research Computing Services, Purdue University aeh@quest.cc.purdue.edu http://quest.cc.purdue.edu/~aeh/ |
| ||||
| Dale, can't thank you enough. Added a get out of jail free "Hit enter if prompt does not return" in case no answerback string is configured and read hangs (no -t switch unfortunately) and script performs flawlessly. Again, many thanks. Regards, Ashley Dawkins. |
| Thread Tools | |
| Display Modes | |
|
|