echo and printf
echo prints text and printf formats it. Use -n to skip the newline and -e for escapes.
Example
echo "Hello"
echo -n "no newline "
echo -e "tab:\tdone"
printf "%s is %d years\n" Ada 30
printf "%05.1f|%-5s|\n" 3.14159 abResult
Hello no newline tab: done Ada is 30 years 003.1|ab |
Exercise
Skip the newline.
echo "hi"
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.