DEV Community

Discussion on: Let's progress together with the Linux Shell

Collapse
 
aminnairi profile image
Amin

Hi Ben and thanks for your answer!

You are right. echo isn't as portable as printf and you are right to point it out.

I'm using it since I have echo available on my operating system and it is a little bit easier to use than printf. And for most GNU/Linux distributions out there, this is also the case. This article is also an opportunity for people not confortable with Shell scripts to discover some of its utility programs so I figured why not. Two birds one stone, right?

If someone is using a distribution that does not include echo, I'll assume this person is also aware of how to edit this script and make it portable again so I didn't worry about it too much when writing this article.

But again you are totally right about its portability. Especially when it comes to using echo with ZSH or in Bash.

Collapse
 
moopet profile image
Ben Sinclair

I'm more on about things like echo -n not being portable than echo itself not existing. It does different things depending on the shell, and if you try to stick to POSIX you're not going to use those options anyway.