D.1 Manipulating tar archives

Remember that when we execute a script with the --test option: the external commands are not executed: a command line is echoed to stdout. It is recommended to use this mode to fine tune the command line options required by tar.

Function: mbfl_file_enable_tar

Declare the tar command. Declaring the intention to use a program

Function: mbfl_exec_tar ARG
Function: mbfl_tar_exec ARG

Execute tar with whatever arguments are used. Return the exit status of the tar process.

Function: mbfl_tar_create_to_stdout DIRECTORY OPT

Create an archive and send it to stdout. The root of the archive is the DIRECTORY. Files are selected with the . (dot) pattern. The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.

Function: mbfl_tar_create_to_file DIRECTORY ARCHIVE OPT

Create an archive named ARCHIVE holding the contents of DIRECTORY. Before creating the archive, the process changes the current directory to DIRECTORY and selects the files with the . (dot) pattern. The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.

Function: mbfl_tar_archive_directory_to_file DIRECTORY ARCHIVE OPT

Like mbfl_tar_create_to_file() but archive all the contents of DIRECTORY, including the directory itself (not its parents). The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.

Function: mbfl_tar_extract_from_stdin DIRECTORY OPT

Read an archive from stdin and extract it under DIRECTORY (using the --directory option of tar). The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.

Function: mbfl_tar_extract_from_file DIRECTORY ARCHIVE OPT

Read an archive from a file and extract it under DIRECTORY (using the --directory option of tar). The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.

Function: mbfl_tar_list ARCHIVE OPT

Print to stdout the list of files in ARCHIVE. The optional arguments OPT are placed on the command line of tar in option position. Return the exit status of the tar process.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.