Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 158

How to detect the spawn failure in expect command

$
0
0

I wrote this script:

#!/bin/shexpect -c "spawn cu -l /dev/ttyUSB0 -s 115200expect \"foo\"send \"bar\""echo $?

And I run it without /dev/ttyUSB0:

$ ls /dev/ttyUSB0ls: cannot access '/dev/ttyUSB0': No such file or directory$ ./test.shspawn cu -l /dev/ttyUSB0 -s 115200cu: open (/dev/ttyUSB0): No such file or directorycu: /dev/ttyUSB0: Line in usesend: spawn id exp4 not open    while executing"send "bar""0

Why expect returns 0?
How can I detect the spawn failure?


Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>