apply2file

Package: WA2L/edrc 1.5.57
Section: General Commands (1)
Updated: 20 September 2010
Index Return to Main Contents

 

NAME

apply2file - apply data stream to file

 

SYNOPSIS

edrc/bin/apply2file [ -h ]

apply2file [ -o ] [ -s ] [ -u user ] [ -g group ] [ -p perm ] -f target_file

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

Apply a data stream provided via pipe to a target file. The target file is untouched if the data stream does not differ from the target file. This is useful to edit files or to generate files which are system dependent.

 

OPTIONS

-h
usage message.

-o
if target file exists, preserve target file permissions. In this case the options -u, -g and -p are ignored.

-s
save the target file prior to the applying of the data stream. To save the target file the sav(1) command is used internally.

-u user
username or UID of the target file.

-g group
groupname or GID of the target file.

-p perm
filepermissions of the target file.

-f target_file
target file where to install the stream.

 

EXIT STATUS

0
no error.

2
operating system not supported, see osid(3)

4
usage displayed.

5
the data is identical with the existing file and the data stream is not applied to the target file.

6
apply2file could not write to the target file.

 

FILES

-

 

EXAMPLES

1) write system information to /etc/issue

        {
                echo
                host=`hostname`
                banner $host
                echo
                uname -rsmp
                echo
        } |\
        apply2file -o -u root -g root -p 640 \
        -f /etc/issue

2) enable the startup of a daemon (samba in this case)

        cat /etc/rc.config.d/samba |\
          sed -e 's/RUN_SAMBA=.*/RUN_SAMBA=1/g' |\
          apply2file -o -f /etc/rc.config.d/samba

 

SEE ALSO

edrcintro(1), sav(1), chmod(1), chown(1)

 

NOTES

apply2file should be used in pre_exec and post_exec scripts of sysconfig to avoid altering of system files if not needed.

 

BUGS

-

 

AUTHOR

apply2file was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2010 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 00:13:54 GMT, March 08, 2025