Java Reference
In-Depth Information
you've got it debugged. Assuming we put those commands into a file called
myscript , here's a sample run:
$ myscript
UI_Button.java ==> GUI_Button.java
UI_Plovar.java ==> GUI_Plovar.java
UI_Screen.java ==> GUI_Screen.java
UI_Tofal.java ==> GUI_Tofal.java
UI_Unsov.java ==> GUI_Unsov.java
...
$
Imagine having to rename 200 files. Now imagine having to do that with
a point-and-click interface. It could take you all morning. With our shell script,
it will be done in seconds.
We can't hope to cover all that we'd like to about shell scripting. Perhaps
we have been able to whet your appetite. There are lots of topics on the subject
of shell programming. We've listed a few at the end of this chapter.
1.3.11
The tar and zip commands allow you to pack data into an archive or extract it
back. They provide lossless data compression (unlike some image compression
algorithms) so that you get back out exactly what you put in, but it can take
up less space when archived. 8 Therefore tar and zip are often used for data
backup, archival, and network transmission.
There are three basic actions that you can take with tar , and you can
specify which action you want with a single letter 9 in the arguments on the
command line. You can either
The tar and zip Commands
8. Well, technically, tar doesn't compress the data in the file, but it does provide a certain
amount of “compression” by cutting off the tail ends of blocks of data; for example, a file of
37 bytes in its own file takes up 4K of disk space since disk blocks are allocated in “chunks”
(not the technical term). When you tar together a whole bunch of files, those extra tail-end
empty bytes are not used (except in the final block of the TAR file). So, for example, 10 files
of 400 bytes could be packed into a single 4K file, instead of the 40K bytes they would occupy
on the filesystem. So, while tar won't compress the data inside the file (and thus is quite
assuredly “lossless”) it does result in a smaller file.
9. Linux option strings always start with a “ - ”, right? Yes, except for tar . It seems there is always
an exception to every rule. The newer versions of tar allow the leading minus sign, but can also
work without it, for historical compatibility reasons. Early versions of UNIX only had single
Search WWH ::




Custom Search