I'm trying to read from a file and add to LDAP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I'm trying to read from a file and add to LDAP
# 1  
Old 09-10-2005
I'm trying to read from a file and add to LDAP

Hi all
I'm trying to write a script that reads from a file and then insert the record by a command line tool into LDAP. here is the file format

FirstName LastName uid password

and here is the script that I wrot:

#!/bin/sh
INPUT='/export/home/user/input'

while read fname lname uid pass
do
imadmin user create -D ServiceAdmin -w **** -n domain.com -d sub.domain.com -F [${fname}] -L [${lname}] -l [${uid}] -W [${pass}] -H mail.domain.com
done < "${INPUT}"

the problem that I faced is that I got this messege:

stty: : Inappropriate ioctl for device

but the record was sccessfully enterd

What does the message mean? what did I do wrong ?

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to add new server into ldap?

Hello Admins, I need help in adding newly built solaris 10 zone into LDAP server. We have LDAP server running on Solaris 10. We just built new solaris zone and would like to add it to LDAP server. The LDAP serves as centralized user administration. Please let me know the steps. (1 Reply)
Discussion started by: snchaudhari2
1 Replies

2. Shell Programming and Scripting

Read file and add it into part of file

Hello let me explain senario. there is a file which name is config and it store main software variable: file main.conf contents: update="1" log_login="0" allow_ports="" deny_ports="21,22,23" and there is a file which name is ports.txt file ports.txt contents: 25,26,27 i... (3 Replies)
Discussion started by: nimafire
3 Replies

3. Solaris

LDAP Client not connecting to LDAP server

I have very limited knowledge on LDAP configuration and have been trying fix one issue, but unsuccessful. The server, I am working on, is Solaris-10 zone. sudoers is configured on LDAP (its not on local server). I have access to login directly on server with root, but somehow sudo is not working... (9 Replies)
Discussion started by: solaris_1977
9 Replies

4. Red Hat

How to add ldapusers in ldap server?

after configured ldap server with 5 user name ldapuser1 ldapuser2 ldapuser3 ldapuser4 ldapuser5 i have configured ldap client in client pc, this five users sucessfully login in client pc, now i want add one more user ldapuser6 how to add (0 Replies)
Discussion started by: ainstin
0 Replies

5. Shell Programming and Scripting

Read a file, add some text and send an email

Hi, If I am asking this question, you must have already figured out , that I am new to Unix, so here it goes I was trying to read a file, add some user defined content to it and send out an email , I did find out a way to achieve this, but looking at the code, it looks a bit crude to me, can... (3 Replies)
Discussion started by: karthikbhuvana
3 Replies

6. Programming

Read file and add value

i have a file outfile.txt which contain 12 22 i have written this program to read the file and show the output,but i dont know how to add these value and show the total. my-codes are #include<cmath> #include<cstdlib> #include<iostream> #include<fstream> using namespace std; int main ()... (4 Replies)
Discussion started by: console
4 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

9. Programming

Cannot read a file with read(fd, buffer, buffersize) function

# include <stdio.h> # include <fcntl.h> # include <stdlib.h> # include <sys/stat.h> int main(int argc, char *argv) { int fRead, fPadded, padVal; int btRead; int BUFFSIZE = 512; char buff; if (argc != 4) { printf ("Please provide all of the... (3 Replies)
Discussion started by: naranja18she
3 Replies

10. Solaris

sudoers file with groups in LDAP

Hello gurus, I've been working on a sudoers file to work with groups in LDAP. I've created the groups in LDAP and added the users to there respective groups. I've also setup my sudoers file to have the groups match what is in LDAP. And I've added ldap to nsswitch.conf in the group line. The... (6 Replies)
Discussion started by: em23
6 Replies
Login or Register to Ask a Question
SQLSRV_FETCH_ARRAY(3)													     SQLSRV_FETCH_ARRAY(3)

sqlsrv_fetch_array - Returns a row as an array

SYNOPSIS
array sqlsrv_fetch_array (resource $stmt, [int $fetchType], [int $row], [int $offset]) DESCRIPTION
Returns the next available row of data as an associative array, a numeric array, or both (the default). PARAMETERS
o $stmt - A statement resource returned by sqlsrv_query or sqlsrv_prepare. o $fetchType - A predefined constant specifying the type of array to return. Possible values are SQLSRV_FETCH_ASSOC, SQLSRV_FETCH_NUMERIC, and SQLSRV_FETCH_BOTH (the default). A fetch type of SQLSRV_FETCH_ASSOC should not be used when consuming a result set with multiple columns of the same name. o $row - Specifies the row to access in a result set that uses a scrollable cursor. Possible values are SQLSRV_SCROLL_NEXT, SQL- SRV_SCROLL_PRIOR, SQLSRV_SCROLL_FIRST, SQLSRV_SCROLL_LAST, SQLSRV_SCROLL_ABSOLUTE and, SQLSRV_SCROLL_RELATIVE (the default). When this parameter is specified, the $fetchType must be explicitly defined. o $offset - Specifies the row to be accessed if the row parameter is set to SQLSRV_SCROLL_ABSOLUTE or SQLSRV_SCROLL_RELATIVE. Note that the first row in a result set has index 0. RETURN VALUES
Returns an array on success, NULL if there are no more rows to return, and FALSE if an error occurs. EXAMPLES
Example #1 Retrieving an associative array. <?php $serverName = "serverNameinstanceName"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo ); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT FirstName, LastName FROM SomeTable"; $stmt = sqlsrv_query( $conn, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) { echo $row['LastName'].", ".$row['FirstName']."<br />"; } sqlsrv_free_stmt( $stmt); ?> Example #2 Retrieving a numeric array. <?php $serverName = "serverNameinstanceName"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo ); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT FirstName, LastName FROM SomeTable"; $stmt = sqlsrv_query( $conn, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) { echo $row[0].", ".$row[1]."<br />"; } sqlsrv_free_stmt( $stmt); ?> NOTES
Not specifying the $fetchType or explicity using the SQLSRV_FETCH_TYPE constant in the examples above will return an array that has both associative and numeric keys. If more than one column is returned with the same name, the last column will take precedence. To avoid field name collisions, use aliases. If a column with no name is returned, the associative key for the array element will be an empty string (""). SEE ALSO
sqlsrv_connect(3), sqlsrv_query(3), sqlsrv_errors(3), sqlsrv_fetch(3). PHP Documentation Group SQLSRV_FETCH_ARRAY(3)