Creating and Using Your Own Variables

You will often find it convenient to store the output of a command you run in your script for use later in the script. Or, you might want to hard-code some information such as a long directory path, but you don’t want to type the whole path every time you need to use it in the script. And if this directory path ever needs to be changed, it would be nice to be able to change it in only one place in the script and yet have it take effect throughout the script. To do this, you must create a variable. A shell variable begins with any letter or underscore (_) character, followed by zero or more numbers, letters, or underscores.

UNIX is Case-Sensitive

Remember that UNIX is case-sensitive. You must use the same ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.