Linux CLI 55 ๐ง shell scripts output text
a - echo in shell scripts
echo command in shell scripting is a fundamental tool for outputting text or variables
echo "Hello, World!" โ prints Hello World
echo $greeting โ prints the content of $greeting variable
you can use escape characters as well
echo "This is a newline:\nAnd this is a tab:\t." โ using tab escape character
-n option avoids new line
echo -n "Hello, " โ avoids new line
b - printf and here document in shell scripts
printf offers more precise control over the output format
printf "Name: %s\nAge: %d\n" "$name" "$age" โ formating text with printf
printf "%.2f\n" "$number" โ Output will be "123.46"
Here documents are a way to pass multi-line text input into commands or scripts.
This is particularly useful for passing large blocks of text or SQL queries.
example 1 โ multiline example
example 2 โ use of variables example
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!