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 ...

Get Linux Shell Scripting with Bash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.