Skip to main content

All Questions

Tagged with
0 votes
1 answer
692 views

how to use expect into bash to automate installation

I have a bash that answers the questions that freefilesync asks during installation, using expect: #!/bin/bash tar -xf FreeFileSync*.tar.gz mv FreeFileSync*.run FreeFileSync.run >/dev/null 2>&...
acgbox's user avatar
  • 785
1 vote
1 answer
7k views

How do I get my expect statement to not output the stdout of the first command?

What I'm trying to do is execute an ssh command that prints out the /etc/shadow file. Obviously that file requires root or sudo permission, and I don't have root creds, therefore I have to use sudo. ...
beechfuzz's user avatar
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
65 views

Expect not exiting non-zero

My real goal is to have a script that will run locally to ssh into a remote server, restart tomcat, and use expect to wait for the "Server startup in" message, or exit non-zero if it sees startup ...
Dave's user avatar
  • 123
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
0 votes
1 answer
3k views

How to handle a condition when an expect script executing another script on a remote host is interrupted?

Im using an expect script to say xyz.exp to login to a remote host and execute another script abc.sh Now most of the times abc.sh runs fine, but there is a scenario where if a certain condition is ...
user417721's user avatar
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
1 answer
440 views

Bash function only works when password manually input

At work I have to run the following function everyday. The function works fine when I am prompted for the password. However, I tried to hardcode my password so that I don't have to enter it in each ...
N Klosterman's user avatar
2 votes
1 answer
17k views

expect + how to verify if dir exists and if not how to create it

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists If APP not exists under adm ...
maihabunash's user avatar
0 votes
1 answer
1k views

How do I build a script shell to send cmd via telnet and log only results?

I would like to make a shell script that can call a range of IPs via telnet, to send a command, and write the result to a file.
Simon's user avatar
  • 1
0 votes
1 answer
2k views

Using EXPECT script with a $ in the password

I'm trying to set a variable in a Linux bash script which includes a $ symbol, i.e. password is Gl@d1us$123 so PASS="Gl@d1us\$123". I can preceed the $ with a \ and it works fine, but when it calls ...
Andy Kendall's user avatar
1 vote
1 answer
880 views

Unbuffer swallows the exit status of killed process

The expect "unbuffer" command seems to swallow the exit status of its child if the process is killed. Is there something that can be done to stop this behavior? It does not swallow the exit status if ...
frankc's user avatar
  • 301
0 votes
3 answers
4k views

Linux: ssh command works outside bash script, but not within script?

I am having problem with the following command: echo "Pass for router:" read -s pass /usr/bin/expect - << EXPCT spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt #...
FernandoSBS's user avatar
  • 2,003
0 votes
1 answer
8k views

Problems using EXPECT is a BASH shell script

This is the code (bash script): echo "Pass for router:" read -s pass /usr/bin/expect <<EOD spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt #echo @pass expect "*...
FernandoSBS's user avatar
  • 2,003
1 vote
1 answer
2k views

Expect and sudo timeout

I have a main shell script that prompts the user for his password. I then would like to call an expect script while passing the password to it. This expect script will run 3 sudo commands. I know the ...
Codrguy's user avatar
  • 325

15 30 50 per page