Re: [dev] Shell style guide

From: Antenore Gatta <>
Date: Tue, 6 Sep 2016 22:34:12 +0200

On 09/06/16 22:14, Evan Gates wrote:
>> This is sometimes true, but printf is not safe as well from that point
>> > of view,
>> > as it's a builtin as well in most shells.
> It's not about builtin vs external, it's about surprises. Whether
> printf if builtin or not, it will behave in a predictable way. Doing
> var=-n
> printf %s\\n "$var"
> echo "$var"
> printf will always give us the same result, echo may or may not
> depending on shell and system.
>> > In scripts where you just need to output text, or to easily list files,
>> > echo is
>> > fine.
>> >
>> > echo *
>> > echo /path/*/whatever/*sh # that is better and faster than "ls"
>> > echo "I'm right"
> And if you have a file named -n or -e? Don't get me wrong, echo has a
> place, and interactive shell is is definitely one of those places. But
> doing this in a script should be avoided.
Good point about file expansion, still I don't see nothing bad in using

for just text and to add blank lines.

As a wider response, maybe, just propose your patches of existing suckless

scripts and maybe propose a patch to split the coding_style suckless page

in two separated pages, one for C and one for shell.

For what it's worth, I'm with you and I can help out.

Let's see what the master have to say.
Received on Tue Sep 06 2016 - 22:34:12 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 06 2016 - 22:36:11 CEST