On Sun, Jan 03, 2021 at 02:38:30PM -0500, Greg Reagle wrote:
> I am in the habit of using printf rather than echo because of the drawbacks of echo as explained in https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo. For
> echo relinking
> specifically, it doesn't matter. For
> echo recompiling $2.c
> specifically, if $2 contains any characters that echo might interpret, it might come out wrong.
>
> > In my opinion the later is easier to read and understand.
>
> Yes I agree that the echo is a bit simpler and easier than the printf, but it
> has disadvantages.
>
Pretty easy to replace echo in your and any scripts, as long as it doesn't use
-n or -e.
echo()
{
printf '%s\n' "$*"
}
Received on Sun Jan 03 2021 - 22:36:56 CET