The echo Command
In this page:
The echo Command
echo prints text to standard output, optionally followed by a newline. It supports flags like -n (no trailing newline) and -e (interpret backslash escapes like \n and \t). It's the most basic way to produce output from a script.
Note: Use echo -e when you need escape sequences like \n to actually create a new line.
Example: The echo Command
#!/bin/bash
echo "Hello, Bash!"
echo -n "No newline after this"
echo ""
echo -e "Line1\nLine2\tTabbed"
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: