Amol Kahat Amol Kahat - 3 months ago 12x
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.


You can try this as well

# cat expectscript
spawn sh
expect "Enter Number:" {send -- "-2394\r"}
expect eof