All Questions
17
questions
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>&...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
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
#...
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 "*...
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 ...