My code snippet:
I have this really annoying problem where question marks get inserted in the code I'm sending with expect like this; f?r. It's supposed to be "for".
After searching I found that you can slow down the speed at which you send things with by using "send_slow". Jeez, just what I want, to bog down my program. Why is this happening? Isn't there anyway to fix this besides slowing down our programs? It ruins regular expressions so the don't work and now I can't depend on my program working correctly at all. It just seems so dumb.
BTW as you can tell. I'm trying to send bash commands to a linux box. To check filenames in a directory. Is there a better way?
Code:
set send_slow {2 0.5}
set shell_commands {
"for FILE in *.*\r"
"do\r"
"if \[\[ \$FILE =~ ^\[A-Z0-9]{32}\[.]\[A-Z0-9]{8}\[.]jpg$ ]]; then\r"
":\r"
"else\r"
"echo \"Fail: \$FILE\"\r"
"fi\r"
"done\r"
}
#Send the commands, need to use "-s" to slow it down so "?"s don't get inserted into sent stream.
foreach command $shell_commands {
exp_send -s $command
expect "> "
}
I have this really annoying problem where question marks get inserted in the code I'm sending with expect like this; f?r. It's supposed to be "for".
Code:
# f?r FILE in *.*
-bash: f?r: command not found
After searching I found that you can slow down the speed at which you send things with by using "send_slow". Jeez, just what I want, to bog down my program. Why is this happening? Isn't there anyway to fix this besides slowing down our programs? It ruins regular expressions so the don't work and now I can't depend on my program working correctly at all. It just seems so dumb.
BTW as you can tell. I'm trying to send bash commands to a linux box. To check filenames in a directory. Is there a better way?