ainsl

Langue: en

Version: 18 june 2008 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)

NAME

ainsl - AppendIfNoSuchLine

SYNOPSIS

ainsl [options] FILE LINE [PATTERN]

DESCRIPTION

Add LINE to the end of FILE if this file does not contain this line already. If PATTERN is given, then the LINE is only appended if PATTERN is not found in the file.

If PATTERN is not given, LINE is used instead for matching a line in FILE. Then LINE may also contain the anchors '^' and '$' which are only treated specialy at the beginning or end of the pattern and are used for matching, not when adding the line. Additionaly, the following characters are escaped in LINE: ( ) +

OPTIONS

-a
Autocreate file if it does not exist.
-D
Create debugging output.
-h
Show help, version and summary of options.
-n
Print the actions, but do not execute them.
-Q
Quote all metacharacters in pattern. Uses perl's \Q function.
-q
Quote * and + metacharacters in pattern.
-s
Convert white space in LINE or PATTERN to '\s+' regexp for matching.
-v
Create verbose output.

EXAMPLES


ainsl -v /etc/fstab '/dev/fd0 /floppy auto users,noauto 0 0'

Append the entry for the floppy device to /etc/fstab, if this line isn't already inlcuded.

ainsl -s /etc/exports '/srv/www @linuxhosts(async,rw) backup(async,ro)'

Add exports entry without exactly matching spaces.

NOTES

This is a similar function to AppendIfNoSuchLine from cfengine(8).

SEE ALSO


This program is part of FAI (Fully Automatic Installation). See the FAI manual for more information on how to use ainsl. The FAI homepage is http://fai-project.org.

AUTHOR

Thomas Lange <lange@informatik.uni-koeln.de>