Variables and Constants

There is an issue with our script, however. Notice how the string System Information Report is repeated? With our tiny script it’s not a problem, but let’s imagine that our script was really long and we had multiple instances of this string. If we wanted to change the title to something else, we would have to change it in multiple places, which could be a lot of work. What if we could arrange the script so that the string appeared only once and not multiple times? That would make future maintenance of the script much easier. Here’s how we could do that:


# Program to output a system information page

title="System Information Report"

echo "<HTML>
                <H1>$title</H1> </BODY> ...

Get The Linux Command Line now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.