System Administration Guide: Naming and Directory Services (NIS+)

Adding an NIS+ Table Entry With the -a Option

The -a option adds an entry to a table unless the entry already exists, in which case it returns an error. An entry is defined as existing if its values in the searchable columns exactly match the values in the new entry's searchable columns. (The values in non-searchable columns are not taken into account.)

To use the -a option, you must specify a value for every column in the table:


nistbladm -a column="value" \
 column="value" \
 ... tablename
nistbladm -a indexedname

(To list the names and characteristics of table columns, use the niscat -o tablename command.)

For example, to add a new row to a table named depts using column=value pairs, you would enter:


rootmaster% nistbladm -a Name='R&D' Site='SanFran' \
 Name='vattel' depts.doc.com.

To add the same entry using an indexed name, you would enter:


rootmaster% nistbladm -a [Name='R&D',Site='SanFran',\
 Name='vattel'],depts.doc.com.

Both examples would produce a table row that looked like this:

Dept 

Site 

Name 

R&D 

SanFran 

vattel 

C-shell users should also use quotes to set off expressions using square brackets.

You can only add one entry with each instance of the nistbladm command. You must run nistbladm once for each entry row you want to add.

If a table row already exists with values in each column that are identical to the entry you are trying to create, nistbladm -a will return an error. You cannot have two identical entry rows in a table. In this context, rows are considered identical if the values in the searchable columns are identical, the values in none search able columns are not considered.

For example, if the Dept and Site columns are searchable, and the Name column is not searchable, nistbladm considers the following two rows to be identical:

Dept (searchable) 

Site (searchable) 

Name (not searchable) 

Sales 

Vancouver 

Hosteen 

Sales 

Vancouver 

Lincoln 

In this example, nistbladm -a would not allow you to create the Sales Vancouver Lincoln row.

However if just some of the searchable columns have values identical to the entry you are trying to create, nistbladm -a will create a new entry as specified. For example, you could run the following commands to create two similar, but not identical, rows in a depts table:


rootmaster% nistbladm -a Dept='Sales' \
   Site='Vancouver' Name='hosteen' staff.doc.com.
rootmaster% nistbladm -a Dept='Sales' \
   Site='SanFran' Name='lincoln' staff.doc.com.

Which would produce rows that had some, but not all identical values in the searchable columns:

Dept 

Site 

Name 

Sales 

Vancouver 

hosteen 

Sales 

SanFran 

lincoln