38.12. Getting tar's Arguments in the Right Ordertar's command line is one of Unix's little mysteries. It's difficult to associate arguments with options. Let's say you want to specify the block size (b), the output file ( f ), and an "exclude" file (X ). Where do you put all this information? It's easy enough to stick the option letters into a lump and put them into a command (tar cXbf). But where do you put the block size, the name of the exclude file, and so on? List any arguments that you need after the block of key letters. You must place the arguments in the same order as the key letters, as shown in Figure 38-1. Figure 38-1. tar options and argumentsIn this command, keepout goes with the X option, 20 goes with the b option, and archive.shar goes with the f option. If we put the options in a different order, we also have to put the arguments in a different order (see Figure 38-2). Figure 38-2. The same command, rearrangedNote that the files you want to put on the tape (or the files you want to extract from the tape) always go at the end of the command. These are not arguments to c or X; they are part of the command itself. The dump command and a few others work the same way. GNU tar understands this traditional syntax as well as two syntaxes with separate options. For instance, the command line above could also be written in either of the following ways with GNU tar: % tar -c -b 20 -X keepout -f archive.tar *.txt % tar --create --block-size=20 --exclude-from=keepout \ --file=archive.tar *.txt -- ML Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|