| 1 |
# A little demonstration of the possibilities of "runscript". |
| 2 |
# This script can be executed by typing: "runscript scriptdemo". |
| 3 |
# |
| 4 |
# Adjust the stty's below to your system: BSD-like or SysV-like. |
| 5 |
# Linux ofcourse accepts both :-) |
| 6 |
# |
| 7 |
|
| 8 |
goto main |
| 9 |
left: |
| 10 |
print "\010 \010\010*\c" |
| 11 |
return |
| 12 |
right: |
| 13 |
print "\010 *\c" |
| 14 |
return |
| 15 |
main: |
| 16 |
# ! stty -echo cbreak |
| 17 |
! stty -echo -icanon min 1 |
| 18 |
verbose off |
| 19 |
print Demo! press 'q' to move left, 'w' to move right, 'ESC' to stop. |
| 20 |
print " *\c" |
| 21 |
expect { |
| 22 |
"q" gosub left |
| 23 |
"w" gosub right |
| 24 |
"\033" break |
| 25 |
} |
| 26 |
print \nEnd of demonstration. |
| 27 |
# ! stty -cbreak echo |
| 28 |
! stty icanon echo min 5 |
| 29 |
sleep 1 |