UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 20.10 Avoid Absolute Paths with tar Chapter 20
Backing Up Files
Next: 20.12 Protecting Files with SCCS or RCS
 

20.11 Getting tar's Arguments in the Right Order

tar'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 20.1.

Figure 20.1: tar Options and Arguments

Figure 20.1

In 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 20.2).

Figure 20.2: The Same Command, Rearranged

Figure 20.2

Note 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.

- ML


Previous: 20.10 Avoid Absolute Paths with tar UNIX Power ToolsNext: 20.12 Protecting Files with SCCS or RCS
20.10 Avoid Absolute Paths with tar Book Index20.12 Protecting Files with SCCS or RCS

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System


Banner.Novgorod.Ru