Using Variables in Shell Scripts
When writing shell scripts for Linux, you work with three types of variables:
• Environment variables—Part of the system environment, you can use them in your shell program. You can define new variables, and you can also modify some of them, such as PATH, within a shell program.
• Built-in variables—Variables such as options used on the command (interpreted by the shell as a positional argument) are provided by Linux. Unlike environment variables, you cannot modify them.
• User variables—Variables defined within a script when you write a shell script. You can use and modify them at will within the shell script, but they are not available to be used outside of the script.
A major difference between shell programming ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access