I am currently writing some code for a shell script that needs a blank line between two parts of the script, as thus they can be separated when output is displayed to the user.
My question is, I am not sure what the preferred practice is in a shell script for a blank line.
Is it preferred practice to just write echo
and nothing else or to write echo " "
as in echo with quotes and blank between the quotes?
In its first implementation,
echo
had no option and outputs optional arguments ending with a new line, so it perfectly suit your needs.For formatted outputs ending with a new line,
printf
is a better choice, for example :printf "%s\n\n" "output"
.All of these commands can be used to echo a blank line:
echo
,echo ''
,echo ""
We cant use
echo "\n"
orecho '\n'
as they will give output as\n
in both cases.echo
is preferred.echo " "
outputs an unnecessary space character.echo ""
would be better, but it's unnecessary.