Subject: Re: [PATCH] Replace "echo -n" with printf in shell scripts.

From: Eric Blake <[email-masked]>
Date: Mon, 15 Jan 2007 20:09:36 -0700

According to Junio C Hamano on 1/15/2007 7:46 PM:
>> -			name=$(echo -n "$f" | tr -c "A-Za-z0-9" ".")
>> +			name=$(printf "$f" | tr -c "A-Za-z0-9" ".")
> 
> This should almost be safe as no sane person would have a remote
> whose name is 'foo%s'...

Why not go all the way, and make it safe, regardless of embedded %,
embedded \, or leading -?

name=$(printf -- %s "$f" | tr -c "A-Za-z0-9" ".")

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email-masked]