Asking username and password in the middle of the Shell/perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Asking username and password in the middle of the Shell/perl script
# 1  
Old 08-25-2011
Asking username and password in the middle of the Shell/perl script

Can any body help me to find out the logic
I have a script chkcomponent.pl Which give some output
Like
component1 userid: u1
component2 userid: u2
component3 userid: u1
.
.
#The no of components are different in different times run
Now I want this chkcomponent.pl script in another script
myscript.pl/sh

problem:-
I want to check all component are running or not
But the problem is that this component are in different different userid So I want to login to different userid separately and check components individually

So I want to put a logic in myscript.pl/sh
which take all userid as argument and ask for password

So that I will check all the component at a time
Smilie
# 2  
Old 08-25-2011
see if this work

Code:
 
while read one two user
         do
        echo "please enter passwd for $user "
        done <sample

please enter passwd for u1
please enter passwd for u2
please enter passwd for u1

where sample is output from ur previous script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Username & password through shell script to java code

Hi, I have a shell script (script.sh) in which we are calling java code which asks for Username: Password: for authentication purpose currently we are passing the credential manually and run the script. but I am trying echo -e "user_id\npassword" | script.sh but its not... (1 Reply)
Discussion started by: rakeshtomar82
1 Replies

2. Shell Programming and Scripting

How to send Two different password in Single script, having same username..?

Hi Team, i want to input two password for single node like pass1/pass2 one of the pass1 is working some node and pass2 is working for some nodes . For nodes having pass1 i have to run different script and for nodes having pass2 i have to run different script Sooo how can put two pass... (3 Replies)
Discussion started by: Ganesh Mankar
3 Replies

3. UNIX for Dummies Questions & Answers

Script to log in SFTP server [with username, password]

Hi, everyone, I am trying to write a script to login automatically using username and password to an sftp server (the key authentication has been disabled so I cannot use that method). I tried to search online for a solution and found a way using "expect" but my boss does not want me to use... (4 Replies)
Discussion started by: warmboy610
4 Replies

4. Shell Programming and Scripting

How can i make the current shell return from the middle of a script reading?

I am using the popular bash shell. Under the current interactive shell, i run the script like: ". ./myscript.txt" . After the current shell has finish the script, the shell will continue to work as I did previously. Actually I want the shell can return from the middle of the scripts it is... (1 Reply)
Discussion started by: Bill Zhao
1 Replies

5. Shell Programming and Scripting

shell script getting stopped at the middle.

I have created a shell scrit to run the informatica workflows sequentially.In the script i am executing 7 workflows sequentially after running 4 workflows the scrpt getting stop and it is not continuing next step evn it is updating logs.4th workflow will take more time to finish is that making... (1 Reply)
Discussion started by: katakamvivek
1 Replies

6. Shell Programming and Scripting

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 #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

7. UNIX for Dummies Questions & Answers

Shell program with username and password

Hi I am new to unix and I am trying to figure out how to write a shell script with a login name and password. I want to do something along the lines of if both are correct it echoes "you are logged in" and if the password is wrong it echoes "wrong password" and same with the login name. I've tried... (7 Replies)
Discussion started by: thedemonhunter
7 Replies

8. Shell Programming and Scripting

Read Oracle Username password SID from single file and pass it to shell

Dear All I am trying to write one shell which will be running through Cron which contain one SQL query. But I want to draw/fetch the Username password and Instance name (required to loging to the database) from one single file to run that SQL query . Also this file contain details of multiple... (2 Replies)
Discussion started by: jhon
2 Replies

9. Solaris

i wanto hardcode password for a username to ssh to a server using script

Dear all i want to ssh to a server via running a shell script with a username and i want to hard code the password for that particular username can u help me please Thank u Naree (8 Replies)
Discussion started by: naree
8 Replies

10. Shell Programming and Scripting

username password in script

Can we write a script to telnet to a unix server from unix with the username and password hardcoded in the script?? something like ssh a@b -p password ??? (5 Replies)
Discussion started by: roshanjain2
5 Replies
Login or Register to Ask a Question