O'Reilly logo

Linux Shell Scripting with Bash by Ken O. Burtch

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

Chapter 18. Final Topics

The arcane and the obscure. The obsolete and the advanced. This final chapter contains a mix of subjects suitable for those who need to know every last detail about the Bash shell.

The echo Command

The built-in echo command is an older form of printf. Bash provides it for compatibility with the Bourne shell. echo does not use a format string: It displays all variables as if "%s\n" formatting was used. It can sometimes be used as a shortcut when you don't need the full features of printf.

$ echo "$BASH_VERSION"
2.05a.0(1)-release

A line feed is automatically added after the string is displayed. It can be suppressed with the -n (no new line) switch.

$ echo -n "This is " ; echo "one line."
This is one line

If the -e (escape ...

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