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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.3 Basic <strong>Linux</strong> C<strong>on</strong>cepts and Commands23You can combine the assignment of a value with the exporting into <strong>on</strong>estep. Since repeating the export doesn’t hurt, you will often see shell scripts usethe export command every time they do an assignment, as if it were part ofthe assignment syntax—but you know better.$ export FILE="/tmp/way.out"$NOTEThe shell uses the dollar sign to distinguish between the variable name and justtext of the same letters. C<strong>on</strong>sider the following example:$ echo first > FILE$ echo sec<strong>on</strong>d > TEXT$ FILE=TEXT$ cat FILEfirst$The cat command will dump the c<strong>on</strong>tents of the file named FILE to thescreen—and you should see first. But how would you tell the shell that youwant to see the c<strong>on</strong>tents of the file whose name you have put in the shellvariable FILE? For that you need the “$”:$ cat $FILEsec<strong>on</strong>d$This is a c<strong>on</strong>trived example, but the point is that shell syntax supports arbitrarystrings of characters in the command line—some of them are filenames,others are just characters that you want to pass to a program. It needs a wayto distinguish those from shell variables. It doesn’t have that problem <strong>on</strong> theassignment because the “=” provides the needed clue. To say it in computerscience terms, the “$” syntax provides the R-value of the variable. (Not theinsulati<strong>on</strong> R-value, but what you expect when a variable is used <strong>on</strong> the Righthand-sideof an assignment operator, as opposed to the L-value used <strong>on</strong> theLeft-hand-side of an assignment operator.)There are several shell variables that are already exported because they areused by the shell and other programs. You may need or want to set them tocustomize your envir<strong>on</strong>ment. Since they are already exported, you w<strong>on</strong>’t needto use the export command and can just assign a value, but it doesn’t hurt.

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

Saved successfully!

Ooh no, something went wrong!