Passing username and password to a script running inside "expect" script
Hi
I'm trying to run a script " abc.sh" which triggers "use.sh" .
abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script.
Please find below the scripts:
#abc.sh
my second script use.sh is placed in /root/ directory..
please find the script below:
When I execute the script abc.sh I get just
Username:
Unless and until I entert it manually it won't proceed ahead. I understand that since now the control is in use.sh , expect is not working. So any workaround for this..??? Please help me out.
Please note that this is just a 4-5 lines script similar to some other script we use in our project. I cannot change anything in "use.sh". I'm free to edit abc.sh.
Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.
Last edited by Corona688; 08-23-2012 at 02:48 PM..
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi All,
i am trying to ssh to a remote machine and execute certain command to remote machine through script.
i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as
expect: spawn id exp5 not open
while executing
"expect "$" {... (3 Replies)
Ladies & Gents,
Can one of you gurus please show me a very simple "expect" script to change the password in Solaris in a script, please? Nothing fancy, no error checking, no nothing. Just to change the password of a new user, it's all.
Many thanks in advance. U guys have honestly earned my... (1 Reply)
Below is the error I'm getting.
# passwd username
Changing password for username.
New Password:
Reenter New Password:
Password changed.
New UNIX password:
Retype new UNIX password:
Password has been already used. Choose another.
passwd: Authentication token manipulation error# cat... (0 Replies)
Friends,
Need someone's help in helping me with the below requirement for a script:
> For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details <
I know, this is possible through expect programming in a simple... (14 Replies)
Friends,
Need someone's help in helping me with the below requirement for a script:
> For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details <
I know, this is possible through expect programming in a simple... (2 Replies)
Hello All,
I have embedded some expect code inside a Bash script I'm writing, but for some reason any variable I 'set' to something is
showing as empty immediately on the next line...
I haven't run into this problem before so I'm not sure what it could be...? I'm guessing it has something to... (4 Replies)
I wrote a script to download the files from sftp location to local. while running the script manually its working fine. when i schedule the same in cron its not working.... :wall::wall:
here is the script:
#!/bin/bash
... (2 Replies)
I'm trying to execute something like this:
exec perl -i -pe 's/\015/\012/g' '${file}'
in my expect script and I get:
error "invalid command name \"perl\".
however, if I run
perl -i -pe 's/\015/\012/g' "/Users/Shared/menu-items.txt"
directly in my terminal, it runs fine. I'm an... (4 Replies)
Hi,
I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone.
And its not dumping core if we run the script using "/bin/sh" instead of "ksh"
Can some body please help me how to resolve this issue.
... (9 Replies)