expect doesn't work correctly with cu

s m sam.gh1986 at gmail.com
Sat Dec 29 10:20:04 UTC 2012


hello every body

i want to run cu via expect shell script. when i run my script, cu is
running and enter its cli. but when i enter a command (like ~s to set
variable) manually , this command doesn't execute and cu cli is closed and
bash return an error that this command is not valid.
this is my shell script:
#!/usr/local/bin/expect
set timeout 20
spawn cu -l /dev/ttyu0 -s 115200 -e
expect "Connected"
send "~s"
expect "~[]"
send "hardwareflow\n"
expect eof

and this is the output:

[root at zharf ~]# /usr/SAM/shell-scripts/runcu.sh
spawn cu -l /dev/ttyu0 -s 115200 -e
Connected
~[set] *all /  *i enter this command manually
[root at zharf ~]# all
bash: all: command not found
[root at zharf ~]#


i don't know what happened when i run cu via expect that doesn't  work
correctly. please let me know if you have any ideas.

yours,
SAM


More information about the freebsd-questions mailing list