13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

26Chapter 1An Embarrassment of Riches: The <strong>Linux</strong> Envir<strong>on</strong>mentyou’ve got it debugged. Assuming we put those commands into a file calledmyscript, here’s a sample run:$ myscriptUI_Butt<strong>on</strong>.java ==> GUI_Butt<strong>on</strong>.javaUI_Plovar.java ==> GUI_Plovar.javaUI_Screen.java ==> GUI_Screen.javaUI_Tofal.java ==> GUI_Tofal.javaUI_Unsov.java ==> GUI_Unsov.java...$Imagine having to rename 200 files. Now imagine having to do that witha point-and-click interface. It could take you all morning. With our shell script,it will be d<strong>on</strong>e in sec<strong>on</strong>ds.We can’t hope to cover all that we’d like to about shell scripting. Perhapswe have been able to whet your appetite. There are lots of books <strong>on</strong> the subjectof shell programming. We’ve listed a few at the end of this chapter.1.3.11 The tar and zip CommandsThe tar and zip commands allow you to pack data into an archive or extract itback. They provide lossless data compressi<strong>on</strong> (unlike some image compressi<strong>on</strong>algorithms) so that you get back out exactly what you put in, but it can takeup less space when archived. 8 Therefore tar and zip are often used for databackup, archival, and network transmissi<strong>on</strong>.There are three basic acti<strong>on</strong>s that you can take with tar, and you canspecify which acti<strong>on</strong> you want with a single letter 9 in the arguments <strong>on</strong> thecommand line. You can either8. Well, technically, tar doesn’t compress the data in the file, but it does provide a certainamount of “compressi<strong>on</strong>” by cutting off the tail ends of blocks of data; for example, a file of37 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-endempty bytes are not used (except in the final block of the TAR file). So, for example, 10 filesof 400 bytes could be packed into a single 4K file, instead of the 40K bytes they would occupy<strong>on</strong> the filesystem. So, while tar w<strong>on</strong>’t compress the data inside the file (and thus is quiteassuredly “lossless”) it does result in a smaller file.9. <strong>Linux</strong> opti<strong>on</strong> strings always start with a “-”, right? Yes, except for tar. It seems there is alwaysan excepti<strong>on</strong> to every rule. The newer versi<strong>on</strong>s of tar allow the leading minus sign, but can alsowork without it, for historical compatibility reas<strong>on</strong>s. Early versi<strong>on</strong>s of UNIX <strong>on</strong>ly had single

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!