Sponsored Content
Top Forums Shell Programming and Scripting loop to read multiple username and password Post 302539311 by abdul.irfan2 on Saturday 16th of July 2011 01:11:44 PM
Old 07-16-2011
loop to read multiple username and password

Hello all, I am i am trying to read username password. Bassicaly, i have file called sidlist and it has my database name, username and password....

looks something like this....

db1, user1, pass1
db2, user2, pass2
db3, user3, pass4


but i dont know how to make it work, until i get rid of user1 and pass1...like below...and only have db1 (database name)...to login to sqlplus...

how can read the parameter2 (username) and parameter3(password) and pass that in a loop ??


$ cat test.sh

###########################
# Check for the oratab file.
###########################
ORATAB=/etc/oratab

##now cat for sid list
for ORACLE_SID in `cat /home/oracle/sidlist`
do

################################################
# Build list of distinct Oracle Home directories.
################################################
OH=`egrep -i ":Y|:N" $ORATAB |grep $ORACLE_SID| grep -v "^#" | grep -v "\*" | cut -d":" -f2 | sort | uniq`
echo $ORACLE_SID
echo $OH

#############################
# Set the Oracle environment.
##############################
ORAENV_ASK=NO
export ORACLE_SID
. oraenv

which sqlplus
echo '#####################################################################################'
done
$
$
$
$ cat sidlist
test
mihran
$


i found this below link...that gives me a idea how to use it....but then how would i use that in a loop ??

https://www.unix.com/shell-programmin...ass-shell.html
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. Shell Programming and Scripting

Read multiple arguments in for loop each time

Hi, Guys I am new to shell programming and just get stuck with one simple question. please kindly help. According to the tutorial here, we can do something like for NODE in "ABC 10" "EFG 20" do set -- $NODE echo "letter is $1, number is $2" done And the result will... (3 Replies)
Discussion started by: yuanli
3 Replies

4. UNIX for Dummies Questions & Answers

How can i hide username/password

hi all, i run sqlplus command on unix(HP-UX) like "sqlplus username/password@serverA @deneme.sql" but when someone run "ps -ef | grep sqlplus", it can see my username and password :( How can i hide username and password. thanx. (1 Reply)
Discussion started by: temhem
1 Replies

5. Shell Programming and Scripting

Read and edit multiple files using a while loop

Hi all, I would like to simply read a file which lists a number of pathnames and files, then search and replace key strings using a few vi commands: :1,$s/search_str/replace_str/g<return> but I am not sure how to automate the <return> of these vis commands when I am putting this in a... (8 Replies)
Discussion started by: cyberfrog
8 Replies

6. UNIX for Advanced & Expert Users

Login through SFTP using username and password

Hi All, I want to login to a server through SFTP by giving username and password, in an automated script. I know that this can be done through public key authentication, but my requirement is to login ONLY through username and password. I am using GNU/Linux server. Please advise me !!!... (4 Replies)
Discussion started by: sparks
4 Replies

7. Shell Programming and Scripting

Username password asked during loging

Hi, Whenever I open my unix box,after providing username and password I get the following message. Are you authorised to use this computer as detailed above? (Y)es/(N)o : y Export: Release 10.2.0.2.0 - Production on Mon May 16 16:00:15 2011 Copyright (c) 1982, 2005, Oracle. All rights... (5 Replies)
Discussion started by: emilybose
5 Replies

8. Shell Programming and Scripting

Username and password

Hi I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Discussion started by: somersetdan
5 Replies

9. UNIX for Dummies Questions & Answers

How do you reset username/password

Picked up a 3b2 running System V. Works fine, but it requires a username and password. Is the username "root" or "sysadm"? How do I find out and how to I reset it or bypass it? Thanks. (2 Replies)
Discussion started by: TanRuNomad
2 Replies

10. Shell Programming and Scripting

[SOLVED] UNIX FOR loop to read a variable with multiple values

Hi, I have a variable which stores file names as a result of find command. I need to delete all these files one by one, i.e. by a loop. Can anyone tell me how can it be done? The variable f2d has the file names like these abc.txt bcd.txt fff.txt gef.txt Now I have used a loop as... (12 Replies)
Discussion started by: jhilmil
12 Replies
LSH-PAM-CHECKPW(8)						    lsh manuals 						LSH-PAM-CHECKPW(8)

NAME
lsh-pam-checkpw - program to check a PAM username/password combination SYNOPSIS
lsh-pam-checkpw username-to-check DESCRIPTION
This manual page documents briefly the lsh-pam-checkpw command. This manual page was written for the Debian distribution because the orig- inal program does not have a manual page. Instead, it has documentation in the GNU Info format; see below. lsh-pam-checkpw is a program that checks if a username and password combination is valid for login by doing a PAM lookup. It is designed to be used as a password helper program for lshd (8), (eg. --password-helper=/usr/sbin/lsh-pam-checkpw. lsh-pam-checkpw takes one required argument, which is the username, and reads the password from stdin, then returns 0 if the password is valid, or 1 otherwise. Note that the password must be supplied exactly, ie. there must be no newline after the password, so if invoking from a shell, just type "<your-password><CTRL-D>". SEE ALSO
lsh(1), lshd(8). The programs are documented fully by Lsh, available via the Info system. AUTHOR
This manual page was written by Timshel Knoll <timshel@debian.org>, for the Debian GNU/Linux system (but may be used by others). lsh-pam-checkpw Jul 05 2002 LSH-PAM-CHECKPW(8)
All times are GMT -4. The time now is 12:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy