O'Reilly logo

Practical UNIX by Steve Moritsugu - DTR Business Systems

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interacting with the User

The following section further demonstrates some of the script commands discussed earlier in this chapter and adds some new ones to your skill set.

Displaying Headings and Prompts

The echo command just displays the argument words it has been given. As such, it is rarely used at the command line. However, it is very useful in shell scripts. Its simplest use is to provide a heading for your output:

#!/bin/sh
echo "Users currently logged in at `date`"
who

In this example, the echo command outputs a heading before the output of the who command is shown. The heading uses backquotes so that the current date and time are inserted into the heading.

The echo command allows for the following formatting escape characters that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required