Skip to main content

All Questions

Tagged with
0 votes
1 answer
336 views

expect spawn command: Escaping newline (\n) in string

I am trying to use expect to interact with the MATLAB console. Currently I have: #!/usr/bin/expect -f spawn {*}/usr/bin/run.sh matlab -r "fprintf(1, \"The identifier was:%s\\\\n\", \&...
user3711775's user avatar
2 votes
1 answer
5k views

expect -timeout vs. "set timeout" in expect: Different behavior

I was testing a expect script and found two different behaviors when using set timeout vs. expect -timeout. Here is a simple example response.sh: #!/usr/bin/bash sleep 2 echo hello test1.sh: #!/usr/...
user3711775's user avatar
0 votes
2 answers
472 views

For cycle with expect and variable evaluation

I want to execute a script remotely with expect and a for loop: #!/usr/bin/expect set timeout 10 spawn ssh [email protected] expect "password: " send "pass\n" expect "$ " ...
michelemarcon's user avatar
0 votes
1 answer
5k views

Setting and using a variable within a single-line Expect command in a Bash script

I have an array, $HOSTS, which contains a set of hostnames. I have a database table that has a set of IP addresses. I want to go through each IP address in that table and send a command (hostname -s) ...
Kefka's user avatar
  • 1,456
0 votes
0 answers
601 views

Obexctl: Provide different result in terminal and script

I have created a script where I want to send file over bluetooth. For that I took "obexctl" utility. I can transfer file using obexctl utility over terminal. But when I'm trying to incorporate the ...
Nikita's user avatar
  • 101
0 votes
1 answer
1k views

How to toggle outlet power to Eaton ePDU G3 from shell script

I'm trying to programmatically toggle power to several outlets on a Eaton ePDU G3 using ssh via Jenkins CI shell script. This is to fire up lidars only during a Jenkins run. It is not clear how to do ...
Dennis Hoer's user avatar
1 vote
1 answer
718 views

TCL/Expect script with if/else logic based on host IP address

So I have been using and enjoying /usr/bin/expect for scripts because it can quickly log me into servers since it autocompletes my userid and password. Through some cursory reading, I've come to ...
user1004512's user avatar
0 votes
1 answer
2k views

Does set timeout change each expect statement, or just the final expect eof?

I'm learning to use /usr/bin/expect for the first time, to automate the nightmare that is installing fink from source, as that script has a few dozen prompts, all of which can be answered with the ...
mcandre's user avatar
  • 3,058
1 vote
1 answer
3k views

How do I send the stdout of a command to an Expect input?

I want to write a shell + expect script that auto-fills my passwords via the LastPass CLI utility lpass. I'm not sure how to accomplish sending the password returned by lpass to the password input in ...
Josiah's user avatar
  • 113
0 votes
1 answer
3k views

Variable expansion and escaping in heredoc syntax

I've got the following script to scrape out the arp table of a switch. No matter how I try to escape everything, quote it or otherwise try I can't get it to work properly. The bash line is interpreted ...
Brando__'s user avatar
  • 103
1 vote
1 answer
3k views

file exists not working in expect script

I'm trying to check if a particular line exists in filename on a host. So only if the particular pattern is found from the grep command a dummy.txt will be created. Then I want to check if dummy.txt ...
user417721's user avatar
0 votes
2 answers
799 views

Not able to copy a file via script from local host to remote host

I am trying to write a script that can copy a file from local host to remote host. And then i want to execute that script from local host. But I am not able to copy. I googled and found the below code....
Aakash Goyal's user avatar
2 votes
2 answers
2k views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
Zach Melnick's user avatar