Sponsored Content
Full Discussion: Help with reading parameter.
Top Forums Shell Programming and Scripting Help with reading parameter. Post 302534291 by beckss on Monday 27th of June 2011 10:51:19 AM
Old 06-27-2011
Hi.
This is code of my script->
Code:
#!/bin/ksh

. ~/applprd.env


read A
read B

username=`echo $A`
echo "We have username $username ...."
pass=`echo $B`
echo "We have old password $pass ...."
passnew=`echo $pass | sed 's/./\\\&/g'`
echo "We have new password ------"$passnew"----- ...."

# Recieve apps and system password ...... 
password=`grep -i password $TOOLS_CONFIG_HOME/../iAS/Apache/Apache/../modplsql/cfg/wdbsvr.app | grep -v portal | cut -d"=" -f2 | sed
 's/ //g'| head -1`
digits_to_cut=`echo ${password} | sed 's/[a-zA-Z]//g' | awk '{print length($1)}'`
if [ ${digits_to_cut} -eq 4 ]; then
  begin_system=`echo ${password} |  sed "s/.\{${digits_to_cut}\}$//" | sed 's/.$/s/g'`
  digits=`echo ${password} | sed 's/[A-Za-z]//g'`
  system=${begin_system}${digits}
else
  begin_system=`echo ${password} |  sed "s/.\{5\}$//" | sed 's/.$/s/g'`
  digits=`echo ${password} | awk '{ print substr($1,length($1)-4,length($1)) }'`
  system=${begin_system}${digits}
fi



# We  recieve user id for changing password ....
USERID=`sqlplus -s apps/$password@ORAPRD_BALANCE << END
set pagesize 0 feedback off verify off heading off echo off
SELECT to_char(a.user_id)
FROM fnd_user a, per_all_people_f f
where a.EMPLOYEE_ID = f.person_id
AND sysdate between f.effective_start_date AND f.effective_end_date
and a.end_date is null
and a.user_name=upper('${username}');
exit;
END`


if [ "${USERID:-"CONTRACT_ID"}" = "CONTRACT_ID" ] ; then
USERID=`sqlplus -s apps/$password@ORAPRD_BALANCE << END
set pagesize 0 feedback off verify off heading off echo off
select to_char(a.user_id)
from fnd_user a
where a.user_name = '${username}';
exit;
END`
fi

echo "We have user_name = ${username} and it's user_id = ${USERID} ....."

# Changing password for specific user ....
cd $FND_TOP/bin
FNDCPASS apps/${password} 0 Y system/${system} USER ${username}  ${passnew}
#echo "User ${username} changed password on `date`  with password ${pass} ....." >> /opt/idm.log


I run this script in EOF manner ->
Code:
./idm.sh << EOF
TEST_HR
123456as;
EOF

I can not use transfer parameter into script due to it cause problem with some spec. characters (like & ' '' Smilie. Therefore I transfer them with read command. (as I explained above).
After parameter B is read it go as passnew into FNDCPASS utility and all \'s before characters are entered into DB.
When you run FNDCPASS from command line with \'s all OK.
I found, that passnew enclose with " and this cause problem.
What you can advice with this issue.
Thanks Staas.

Last edited by Franklin52; 06-28-2011 at 03:39 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how do I make dynamic parameter names? Or get the value of a parameter evaluated twi

Say I write something like the following: var1=1 var2=2 for int in 1 2 do echo "\$var$int" done I want the output to be: 1 2 Instead I get something like: $var1 $var2 (2 Replies)
Discussion started by: Awanka
2 Replies

2. Shell Programming and Scripting

reading the parameter from another file

I have a script where 3 parametrs are passed to it and it creates the file for each site form a template. If i want to get the 3rd parameter (which is the site) passed to the script to come from another file how I can change the script tp acheive it? Here is my script: what i have in the... (15 Replies)
Discussion started by: dsravan
15 Replies

3. Shell Programming and Scripting

Reading a Parameter File

Hi, I need to read the parameters from a file and assign them to Global variables. I need to read a specific parameter value every time and pass it to the other script. Suppose i have a parameter file like PARAM.txt PAR1= VAL1 PAR2= VAL2 PAR3= VAL3 I want to read PAR2 file and in the... (1 Reply)
Discussion started by: Raamc
1 Replies

4. UNIX for Dummies Questions & Answers

Reading from a file(passing the file as input parameter)

hi I have a shell script say primary.sh . There is a file called params my scenario is primary.sh should read all the values and echo it for example i should pass like $primary.sh params output would be Abc ... (2 Replies)
Discussion started by: ssuresh1999
2 Replies

5. Shell Programming and Scripting

Reading a variable from parameter file

HI all, I have a parameter file with entries like $$Name =Abhinav $$CUTOFF_DATE = 11/11/2209 I am reading a variable from this file using a awk command like : var2=`awk -F"" "/CUTOFF_DATE/{f=$1;}{print f;}" InputFIleName` but facing an error like awk: cmd. line:1:... (3 Replies)
Discussion started by: abhinav192
3 Replies

6. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

7. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

8. Shell Programming and Scripting

Resolving a parameter which is passed as parameter

Hi, I have the following files. ->cat scr.sh export TMP_DIR=/home/user/folder1 export TMP_DIR_2=/home/user/folder2 while read line do cat "$line" done<file_list.dat ------------------------ -> cat file_list.dat $TMP_DIR/file1.txt $TMP_DIR_2/file2.txt --------------------------- -> cat... (6 Replies)
Discussion started by: barath
6 Replies

9. Shell Programming and Scripting

Call Script with Parameter (that has another parameter)

Hi. How do I achieve this sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
Discussion started by: aimy
7 Replies

10. Shell Programming and Scripting

To call Oracle procedure by reading parameter file in UNIX

hi Guys, is there a way to pass parameter into oracle store procedure by reading date range in file and increment accordingly. Something like this file.txt 01-JAN-2015 03-JAN-2015 sqlplus -s user/pwd@DB execute TEST( to_date( '01-JAN-2015, 'dd.mm.yyyy' ), to_date( '03-JAN-2015', ... (1 Reply)
Discussion started by: rohit_shinez
1 Replies
PASSWORD_VERIFY(3)							 1							PASSWORD_VERIFY(3)

password_verify - Verifies that a password matches a hash

SYNOPSIS
boolean password_verify (string $password, string $hash) DESCRIPTION
Verifies that the given hash matches the given password. Note that password_hash(3) returns the algorithm, cost and salt as part of the returned hash. Therefore, all information that's needed to verify the hash is included in it. This allows the verify function to verify the hash without needing separate storage for the salt or algorithm information. PARAMETERS
o $password - The user's password. o $hash - A hash created by password_hash(3). RETURN VALUES
Returns TRUE if the password and hash match, or FALSE otherwise. EXAMPLES
Example #1 password_verify(3) example <?php // See the password_hash() example to see where this came from. $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; if (password_verify('rasmuslerdorf', $hash)) { echo 'Password is valid!'; } else { echo 'Invalid password.'; } ?> The above example will output: Password is valid! SEE ALSO
password_hash(3), userland implementation. PHP Documentation Group PASSWORD_VERIFY(3)
All times are GMT -4. The time now is 08:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy