Amol Kahat Amol Kahat - 1 year ago 89
Linux Question

Expect not accepting negative values

I am trying to run

with negative values. But I'm getting bad flag error.

Test File:

echo "Enter Number:"
read num
echo $num

Expect File:

spawn sh
expect -- "Enter Number:" {send "-342345"}

I even tried to escape negative values with
option still it's not working.

Answer Source

You can try this as well

# cat expectscript
spawn sh
expect "Enter Number:" {send -- "-2394\r"}
expect eof
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download