From: Jason Riedy Date: Tue, 16 Jan 2007 03:03:53 GMT Subject: Re: [PATCH] Replace "echo -n" with printf in shell scripts. Message-ID: <18039.1168916633@lotus.CS.Berkeley.EDU> In-Reply-To: <7v1wlv1yeh.fsf@assigned-by-dhcp.cox.net> And Junio C Hamano writes: > We have done this already so it might be too late to raise this > question, but does everybody have printf? It's in the Single Unix Spec as the alternative to non-portable echo uses: http://opengroup.org/onlinepubs/007908799/xcu/echo.html#tag_001_014_525 And no one has complained so far... > > - 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'... Forgot about that, thanks. It should be printf "%s" "$f". Jason