Sponsored Content
Full Discussion: tar exit status
Top Forums UNIX for Dummies Questions & Answers tar exit status Post 13705 by Neo on Tuesday 22nd of January 2002 03:31:23 PM
Old 01-22-2002
You can create multivolume backups with tar. From the man page:

Quote:

-M, --multi-volume
create/list/extract multi-volume archive
TAR is quite powerful...... here is an example of the range of options from the man page:

Quote:

NAME
tar - The GNU version of the tar archiving utility

SYNOPSIS
tar [ - ] A --catenate --concatenate | c --create | d
--diff --compare | r --append | t --list | u --update | x
-extract --get [ --atime-preserve ] [ -b, --block-size N ]
[ -B, --read-full-blocks ] [ -C, --directory DIR ] [
--checkpoint ] [ -f, --file [HOSTNAME:]F ] [ --force-
local ] [ -F, --info-script F --new-volume-script F ] [
-G, --incremental ] [ -g, --listed-incremental F ] [ -h,
--dereference ] [ -i, --ignore-zeros ] [ --ignore-failed-
read ] [ -k, --keep-old-files ] [ -K, --starting-file F ]
[ -l, --one-file-system ] [ -L, --tape-length N ] [ -m,
--modification-time ] [ -M, --multi-volume ] [ -N,
--after-date DATE, --newer DATE ] [ -o, --old-archive,
--portability ] [ -O, --to-stdout ] [ -p, --same-permis-
sions, --preserve-permissions ] [ -P, --absolute-paths ] [
--preserve ] [ -R, --record-number ] [ --remove-files
] [ -s, --same-order, --preserve-order ] [ --same-owner ]
[ -S, --sparse ] [ -T, --files-from F ] [ --null ] [
--totals ] [ -v, --verbose ] [ -V, --label NAME ] [
--version ] [ -w, --interactive, --confirmation ] [ -W,
--verify ] [ --exclude FILE ] [ -X, --exclude-from FILE
] [ -y, --bzip2, --bunzip2 ] [ -Z, --compress, --uncom-
press ] [ -z, --gzip, --ungzip ] [ --use-compress-
program PROG ] [ --block-compress ] [ -[0-7][lmh] ]

filename1 [ filename2, ... filenameN ]

directory1 [ directory2, ...directoryN ]
Tons of options !!!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exit status

i downloaded a text file from metalab.unc.edu called sh.txt and in this reference manual it refers to shell scripting exit status .. at the end of one of the examples that author gave an exit status of 127.. to what does a 127 exit status refer too and what is its purpose in the code. moxxx68 (1 Reply)
Discussion started by: moxxx68
1 Replies

2. Shell Programming and Scripting

Problem with exit status

Hi, Consider the output of the following commands: case1) ------- # ifconfig -a | grep "UP" | grep uplink0:1 # echo $? Output is: 0 case2 ------ # ifconfig -a | grep "UP" | grep uplink0:1; echo $? Output is: 1 In case2 we got the exit code as 1, which is the actual exit code.... (1 Reply)
Discussion started by: diganta
1 Replies

3. Shell Programming and Scripting

Checking Exit Status

I hope one of you smart people out there can help me with what seems like a real simple questing but I can't quite figure out. In a script I am doing a cmp on two files. I am trying to check the exit status with an if statement but can't seem to figure out the syntax. If the exit status is 1 I... (4 Replies)
Discussion started by: PrimeRibAndADew
4 Replies

4. Shell Programming and Scripting

How to get the exit status

Hi all, I'm running a program which return 1 upon success. But when encounters problem shell return 's '1' . How to differentiate between them the shell return value and script return value. Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies

5. Shell Programming and Scripting

Exit status

I'm preparing for exam and one of exams is to write own test command... I wonder if in unix is a command which just returns exit code you specify.. I know I can easily write a function like this: exStatus() { return $1 } -> my question is rather theoretical thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies

6. Shell Programming and Scripting

Check for exit status

Hi I have following code I want If whole code executes successfully then return true If found any error then print the error I tried if ; then But this checks only for the just upper line execution #!/bin/bash PATH1=/var/log/mysql PATH2=/home/ankur/log FILE1=mysql-bin.index... (4 Replies)
Discussion started by: kaushik02018
4 Replies

7. Shell Programming and Scripting

Exit status of grep

I am trying to get the exit status of grep and test a condition with it, But it does not seem to be working as expected since i am doing something wrong apparently as per grep help Exit status is 0 if match, 1 if no match, and 2 if trouble. My problem is something like this templine - a... (7 Replies)
Discussion started by: prasbala
7 Replies

8. UNIX for Dummies Questions & Answers

Processes and exit status

Hi, I can't understand why the last $? is 1? can somebody plz help me to understand it? thanks $ ksh $ ps -f UID PID PPID C STIME TTY TIME COMMAND msarabad 12361 12319 0 15:17:58 pts/1 0:00 ksh msarabad 12319 12317 0 15:15:11 pts/1 0:00 -sh msarabad 12362 12361 ... (7 Replies)
Discussion started by: messi777
7 Replies

9. Shell Programming and Scripting

Exit Status

I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies

10. Shell Programming and Scripting

Want to get the exit status

Hi All, I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully. After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies
TAR(1)							    BSD General Commands Manual 						    TAR(1)

NAME
tar -- The GNU version of the tar archiving utility SYNOPSIS
tar [-] A --catenate --concatenate | c --create | d --diff --compare | --delete | r --append | t --list | --test-label | u --update | x --extract --get [options] [pathname ...] DESCRIPTION
Tar stores and extracts files from a tape or disk archive. The first argument to tar should be a function; either one of the letters Acdrtux, or one of the long function names. A function letter need not be prefixed with ``-'', and may be combined with other single-letter options. A long function name must be prefixed with --. Some options take a parameter; with the single-letter form these must be given as separate arguments. With the long form, they may be given by appending =value to the option. FUNCTION LETTERS
Main operation mode: -A, --catenate, --concatenate append tar files to an archive -c, --create create a new archive -d, --diff, --compare find differences between archive and file system --delete delete from the archive (not on mag tapes!) -r, --append append files to the end of an archive -t, --list list the contents of an archive --test-label test the archive volume label and exit -u, --update only append files newer than copy in archive -x, --extract, --get extract files from an archive OTHER OPTIONS
Operation modifiers: -[0-7][lmh] specify drive and density -a, --auto-compress use archive suffix to determine the compression program --add-file=FILE add given FILE to the archive (useful if its name starts with a dash) --anchored patterns match file name start --no-anchored patterns match after any `/' (default for exclusion) --atime-preserve preserve access times on dumped files, either by restoring the times --no-auto-compress do not use archive suffix to determine the compression program -b, --blocking-factor BLOCKS BLOCKS x 512 bytes per record -B, --read-full-records reblock as we read (for 4.2BSD pipes) --backup backup before removal, choose version CONTROL -C, --directory DIR change to directory DIR --check-device check device numbers when creating incremental archives (default) --no-check-device do not check device numbers when creating incremental archives --checkpoint display progress messages every NUMBERth record (default 10) --checkpoint-action=ACTION execute ACTION on each checkpoint --delay-directory-restore delay setting modification times and permissions of extracted --no-delay-directory-restore cancel the effect of --delay-directory-restore option --exclude=PATTERN exclude files, given as a PATTERN --exclude-backups exclude backup and lock files --exclude-caches exclude contents of directories containing CACHEDIR.TAG, --exclude-caches-all exclude directories containing CACHEDIR.TAG --exclude-caches-under exclude everything under directories containing CACHEDIR.TAG --exclude-tag=FILE exclude contents of directories containing FILE, except --exclude-tag-all=FILE exclude directories containing FILE --exclude-tag-under=FILE exclude everything under directories containing FILE --exclude-vcs exclude version control system directories -f, --file ARCHIVE use archive file or device ARCHIVE -F, --info-script, --new-volume-script NAME run script at end of each tape (implies -M) --force-local archive file is local even if it has a colon --full-time print file time to its full resolution -g, --listed-incremental FILE handle new GNU-format incremental backup -G, --incremental handle old GNU-format incremental backup --group=NAME force NAME as group for added files -h, --dereference follow symlinks; archive and dump the files they point to -H, --format FORMAT create archive of the given formatFORMAT is one of the following: --format=gnu GNU tar 1.13.x format --format=oldgnu GNU format as per tar <= 1.12 --format=pax POSIX 1003.1-2001 (pax) format --format=posix same as pax --format=ustar POSIX 1003.1-1988 (ustar) format --format=v7 old V7 tar format --hard-dereference follow hard links; archive and dump the files they refer to -i, --ignore-zeros ignore zeroed blocks in archive (means EOF) -I, --use-compress-program PROG filter through PROG (must accept -d) --ignore-case ignore case --no-ignore-case case sensitive matching (default) --ignore-command-error ignore exit codes of children --no-ignore-command-error treat non-zero exit codes of children as error --ignore-failed-read do not exit with nonzero on unreadable files --index-file=FILE send verbose output to FILE -j, --bzip2 -J, --xz -k, --keep-old-files don't replace existing files when extracting -K, --starting-file MEMBER-NAME begin at member MEMBER-NAME in the archive --keep-newer-files don't replace existing files that are newer than their archive copies -l, --check-links print a message if not all links are dumped -L, --tape-length NUMBER change tape after writing NUMBER x 1024 bytes --level=NUMBER dump level for created listed-incremental archive --lzip --lzma --lzop -m, --touch don't extract file modified time -M, --multi-volume create/list/extract multi-volume archive --mode=CHANGES force (symbolic) mode CHANGES for added files --mtime=DATE-OR-FILE set mtime for added files from DATE-OR-FILE -n, --seek archive is seekable -N, --newer, --after-date DATE-OR-FILE only store files newer than DATE-OR-FILE --newer-mtime=DATE compare date and time when data changed only --null -T reads null-terminated names, disable -C --no-null disable the effect of the previous --null option --numeric-owner always use numbers for user/group names -O, --to-stdout extract files to standard output --occurrence process only the NUMBERth occurrence of each file in the archive; --old-archive, --portability same as --format=v7 --one-file-system stay in local file system when creating archive --overwrite overwrite existing files when extracting --overwrite-dir overwrite metadata of existing directories when extracting (default) --no-overwrite-dir preserve metadata of existing directories --owner=NAME force NAME as owner for added files -p, --preserve-permissions, --same-permissions extract information about file permissions (default for superuser) -P, --absolute-names don't strip leading `/'s from file names --pax-option=keyword[[:]=value][,keyword[[:]=value]]... control pax keywords --posix same as --format=posix --preserve same as both -p and -s --quote-chars=STRING additionally quote characters from STRING --no-quote-chars=STRING disable quoting for characters from STRING --quoting-style=STYLE set name quoting style; see below for valid STYLE values -R, --block-number show block number within archive with each message --record-size=NUMBER NUMBER of bytes per record, multiple of 512 --recursion recurse into directories (default) --no-recursion avoid descending automatically in directories --recursive-unlink empty hierarchies prior to extracting directory --remove-files remove files after adding them to the archive --restrict disable use of some potentially harmful options --rmt-command=COMMAND use given rmt COMMAND instead of rmt --rsh-command=COMMAND use remote COMMAND instead of rsh -s, --preserve-order, --same-order sort names to extract to match archive -S, --sparse handle sparse files efficiently --same-owner try extracting files with the same ownership as exists in the archive (default for superuser) --no-same-owner extract files as yourself (default for ordinary users) --no-same-permissions apply the user's umask when extracting permissions from the archive (default for ordinary users) --no-seek archive is not seekable --show-defaults show tar defaults --show-omitted-dirs when listing or extracting, list each directory that does not match search criteria --show-transformed-names, --show-stored-names show file or archive names after transformation --sparse-version=MAJOR[.MINOR] set version of the sparse format to use (implies --sparse) --strip-components=NUMBER strip NUMBER leading components from file names on extraction --suffix=STRING backup before removal, override usual suffix ('~' unless overridden by environment variable SIMPLE_BACKUP_SUFFIX) -T, --files-from FILE get names to extract or create from FILE --to-command=COMMAND pipe extracted files to another program --totals print total bytes after processing the archive; --transform, --xform EXPRESSION use sed replace EXPRESSION to transform file names -U, --unlink-first remove each file prior to extracting over it --unquote unquote filenames read with -T (default) --no-unquote do not unquote filenames read with -T --utc print file modification times in UTC -v, --verbose verbosely list files processed -V, --label TEXT create archive with volume name TEXT; at list/extract time, use TEXT as a globbing pattern for volume name --volno-file=FILE use/update the volume number in FILE -w, --interactive, --confirmation ask for confirmation for every action -W, --verify attempt to verify the archive after writing it --warning=KEYWORD warning control --wildcards use wildcards (default for exclusion) --wildcards-match-slash wildcards match `/' (default for exclusion) --no-wildcards-match-slash wildcards do not match `/' --no-wildcards verbatim string matching -X, --exclude-from FILE exclude patterns listed in FILE -z, --gzip, --gunzip --ungzip -Z, --compress, --uncompress ENVIRONMENT
The behavior of tar is controlled by the following environment variables, among others: SIMPLE_BACKUP_SUFFIX Backup prefix to use when extracting, if --suffix is not specified. The backup suffix defaults to `~' if neither is specified. TAR_OPTIONS Options to prepend to those specified on the command line, separated by whitespace. Embedded backslashes may be used to escape whitespace or backslashes within an option. TAPE Device or file to use for the archive if --file is not specified. If this environment variable is unset, use stdin or stdout instead. TAR_LONGLINK_100 EXAMPLES
Create archive.tar from files foo and bar. tar -cf archive.tar foo bar List all files in archive.tar verbosely. tar -tvf archive.tar Extract all files from archive.tar. tar -xf archive.tar SEE ALSO
tar(5), symlink(7), rmt(8) HISTORY
The tar command appeared in Version 7 AT&T UNIX. BUGS
The GNU folks, in general, abhor man pages, and create info documents instead. Unfortunately, the info document describing tar is licensed under the GFDL with invariant cover texts, which makes it impossible to include any text from that document in this man page. Most of the text in this document was automatically extracted from the usage text in the source. It may not completely describe all features of the pro- gram. Dec 31, 2012
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy