More about echo

Many will agree that echo is pretty useful. I use it for a variety of stuff, from querying values of variables to seeing the output of an expanded wildcard.

However echo has several options.

echo -n “Stuff to print”; does not print a newline at the end of Stuff to do. This is useful for prompting the user to input data.

echo -n “Enter your name: “

Escape sequence detection can be enabled with the -e option. Here the arguments are checked for the presence of escape sequences, which enables greater formatting of output.

echo -e “This will be on a \nNew Line.\c”

The \n prints “New Line” on a new line. The \c acts like the -n option and suppresses the newline at the end.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: