mapping userid to an email in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mapping userid to an email in script
# 1  
Old 08-11-2010
mapping userid to an email in script

i have about 20 different users submitting a web form that executes a unix script in the background that sets EXECUTIONUSER to their unix id. i would like to use $EXECUTIONUSER to set their email address as EMAILADDR. of course their unix id does not match their email name either. for example:

Code:
if [ "$EXECUTIONUSER" = "unixid1" ]; then
EMAILADDR="1user@domain.com"
fi

the above could be done for each user but that seems kind of elementary. any crafty suggestions? thanx in advance.
# 2  
Old 08-11-2010
using *sh, you could use a 'for' loop, but it's gonna loop each item. Smilie

I suggest you create your own function, that would exit as it matches the right item.
it's a bit like a script: it takes arguments/parameters
it's a bit like a 'for' loop: you have to make it "re-call" itself with shifted args...
this is recursive function. (is it?)

Last edited by daPeach; 08-11-2010 at 11:55 AM..
# 3  
Old 08-11-2010
Hi
1. Create a file in which you map user-id with email ids as shown below:

Code:
# cat file
12 abc@unix.com
23 xyz@unix.com
54 efg@unix.com
#

2. In the code use this file to get the appropriate email id.

Code:
#EUSER=12
# EMAIL=`awk '$1=='$EUSER'{print $2}' file`
# echo $EMAIL
abc@unix.com
#

Guru.
This User Gave Thanks to guruprasadpr For This Post:
# 4  
Old 08-11-2010
thanks for the response! this was pretty easy to implement as i already had a file with email addresses in it for the drop down on the web form. so i simply used your suggestion to put the unix id in front of the email address. i then used a variation of your code to set the EMAIL variable. thank again.

Code:
EMAIL=`cat file | grep $EUSER | awk '{print $2}'`

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script Entry to block 9 characters userid

Hi Guys, I have one script which is used to add new user in the system. This is how we add new user in system:- sudo /opt/local/bin/new-user 114 ranivarm "Rani Varma(Libo Technical User)" INC00001111 Where 114:-is the site id ranivarm:- is userid "Rani Varma(Libo Technical User)" :-... (11 Replies)
Discussion started by: manalisharmabe
11 Replies

2. Shell Programming and Scripting

awk script - redirecting out put based on mapping

Need awk solution. Please advise. inputfile.txt 1,NY, 1111 2,MI, 222 3,NY,333 4,OH,444 5,OH,555 mapping.txt NY NYNY IL ILLINOIS OH OHIO Need to write a code which will compare 2nd column of inputfile.txt with mapping file and redirect output based on the... (2 Replies)
Discussion started by: vegasluxor
2 Replies

3. Shell Programming and Scripting

Script to check ETL standards in an Informatica mapping

Hi, Script to check the ETL standards in an informatica mapping ( xml file ). Example: To check the naming standard of mapping . To check the transformation naming convention. To check the datatypes. To the session name , it should start with s. To check the workflow name , it should... (0 Replies)
Discussion started by: srimadhuri
0 Replies

4. Shell Programming and Scripting

Creating unique mapping from multiple mapping

Hello, I do not know if this is the right title to use. I have a large dictionary database which has the following structure: where a b c d e are in English and p q r s t are in a target language., the two separated by the delimiter =. What I am looking for is a perl script which will take... (5 Replies)
Discussion started by: gimley
5 Replies

5. UNIX for Advanced & Expert Users

NFS client-side userid mapping

Folks, I am trying to solve the following problem. I have a process on machine A running as root that needs to mount and access an NFS partition being exported from machine B. However, I cannot have 'no_root_squash' option given on B, hence I see NFS requests from machine A end up as 'nobody'... (1 Reply)
Discussion started by: helpmelearn
1 Replies

6. Shell Programming and Scripting

Script to find systems logged in with a particular userid

Hello All, I need to design a script to get all the systems names(IP Addresses) logged in with a particular userid say 'xyz' from different terminals. This is to track the use of the particular userid and take action if it is being misused. The script would accomplish the following steps: 1.... (1 Reply)
Discussion started by: mehimadri
1 Replies

7. Shell Programming and Scripting

Mapping name into unix script

Hi, How do i call a mapping name and workflow name of an informatica tool in the unix script inorder to execute the mapping. It would be great if any one of u help me in getting a mapping name in a unix script. Thanks in advance (0 Replies)
Discussion started by: raji35
0 Replies

8. Shell Programming and Scripting

Can any one share a unix script for validating the export of a mapping which is in XM

Hi, Can any one share a unix script for validating the export of a mapping which is in XML format. like my requirment is that when ever we are migrating the mappings or wokflows from development to QA we will take the export of that mapping into an XML file.Insted of reviewing the mapping... (1 Reply)
Discussion started by: perlamohan
1 Replies

9. UNIX for Dummies Questions & Answers

Call unix script through informatica mapping

hi, i want to call unix script from transformations used in informatica mapping? can we do it in any way? Please reply ASAP. We cant use Storep procedure transformation Thanks in Advance nishith (0 Replies)
Discussion started by: Nishithinfy
0 Replies

10. Shell Programming and Scripting

Logging OWB mapping execution in Shell script

Hi, I am executing a OWB mapping from a shell script like this $OWB_SQLPLUS MY_WAREHOUSE plsql MY_MAPPING "," "," I want to log this mapping execution process into a file. Please let me know if this will work: $OWB_SQLPLUS MY_WAREHOUSE plsql MY_MAPPING "," "," >> LOGFIL.log I will... (1 Reply)
Discussion started by: npn
1 Replies
Login or Register to Ask a Question