Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Dec 2012 13:49:57 +0330
From:      s m <sam.gh1986@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   expect doesn't work correctly with cu
Message-ID:  <CAA_1SgGc8ATpaQ%2Bz3XuwjfJyQQH7hu_r6WagGE0SNYswBpAjNw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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@zharf ~]# /usr/SAM/shell-scripts/runcu.sh
spawn cu -l /dev/ttyu0 -s 115200 -e
Connected
~[set] *all /  *i enter this command manually
[root@zharf ~]# all
bash: all: command not found
[root@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAA_1SgGc8ATpaQ%2Bz3XuwjfJyQQH7hu_r6WagGE0SNYswBpAjNw>