Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

Echo

The echo function is a seemingly simple one, which actually turns out to be quite useful. Since in a terminal you have no easy way of viewing variables (by opposition to, say, Matlab's variable editor), displaying their content is a common need.

Typical syntax is:

echo 'This is a string'
-> This is a string

MyVar='This is the content of the MyVar variable'
echo $MyVar
-> This is the content of the MyVar variable'

If you use echo in a Bash script to report on progress, it may be better to display multiple things on a line, which can be achieved by using the -n option.

Edit - History - Print - Recent Changes - Search
Page last modified on August 06, 2015, at 11:51 AM