echo (display text)

team bbl


Displays the text or variables specified.

 Format:    echo textstring Examples:  echo Hello World            echo $HOME 

The first example displays Hello World on the screen. The second example displays the contents of the variable HOME. $ indicates that HOME is a variable. HOME contains the path to your home directory, so the second example displays the path to your home directory on the screen.

You can use some special characters with the echo command to format the output, shown in the first table below. The second table shows the most useful options for echo.

Char

What It Does

Example

\a

Alert (rings bell)

echo \aerror

\b

Backspace

echo \bHello

\c

Suppress new line

echo $text_line\c

\f

Form feed

echo Hello World\f

\n

Start a new line

echo Hello \nWorld

\r

Carriage return

echo Hello World\r

\t

Insert a tab

echo Hello \tWorld

\v

Insert a vertical tab

echo \vHello World

\\

Literal

echo This is a backslash \\


Opt

What It Does

Example

-n

Don't start a new line after text

 echo -n Hello echo " World Hello World 


    team bbl



    Spring Into Linux
    Spring Into Linux
    ISBN: 0131853546
    EAN: 2147483647
    Year: 2005
    Pages: 362
    Authors: Janet Valade

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net