minicom script exiting immediately

6.4k Views Asked by At

I have written the following minicom script:

sleep 20
send "\n"
expect {
    "#" break
}
send "\n"
send "uname -a"
expect {
   "Linux:" break
}

The command used to run the script is:

sudo minicom -S v.runscript -C minicom.log

But when I run this command, once I enter password for sudo it exits immediately. Even sleep at the start of is not working. 'minicom.log' file is also empty.

What might me missing in the script or command used to run the script?

Note about script:

When I use 'sudo minicom' manually, it takes around 10 seconds to give the prompt. So I have included 'sleep 20' at the start.

Also I am not prompted for login and password if the earlier session was exited with user still logged in. So I do not expect login / password prompts while using run script also.

1

There are 1 best solutions below

0
On

you should write:

send "\n"
expect {
    "#" break
    timeout 20
}
send "\n"
send "uname -a"
expect {
    "Linux:" break
}