Name

-u

Synopsis

The editmap program must be run with one of three mandatory command-line switches. This -u switch is one of those three.

The -u command-line switch tells editmap to open the database file in read/write mode, to look up the key, and to replace that key’s value. If the key is not already in the database, both the key and its value are added to the database:

% editmap -u dbtype dbfile sought-key new-value 

If the dbfile lacks read/write permission, the following error will print and editmap will exit with an EX_IOERR (EX_IOERR) exit value:

editmap: error opening type dbtype map dbfile: Permission denied

If the sought-key is found, its value is replaced with the new-value. If the sought-key is not found, both the key and value are added to the database.

Be careful updating aliases-style database files. If you omit the -N command-line switch with such files, your key will not be found even if it exists, and thus the key and value will wrongly, and silently, update the database. To illustrate, consider this alias:

bob: bob@another.host.domain

If bob moves, you might want to directly edit this aliases-style database to change his address. Here is the correct way to update:

% editmap -N -q hash offsite-aliases bob
bob@another.host.domain
% editmap -N -u hash offsite-aliases bob bob@new.domain
% editmap -N -q hash offsite-aliases bob
bob@new.domain

Here, because offsite-aliases is an aliases-style database, we use the -N command-line switch with all commands. The first and last ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.