public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jason Riedy <ejr@cs•berkeley.edu>
To: Junio C Hamano <junkio@cox•net>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] Replace "echo -n" with printf in shell scripts.
Date: Mon, 15 Jan 2007 19:03:53 -0800	[thread overview]
Message-ID: <18039.1168916633@lotus.CS.Berkeley.EDU> (raw)
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

  reply	other threads:[~2007-01-16  3:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16  1:31 [PATCH] Replace "echo -n" with printf in shell scripts Jason Riedy
2007-01-16  2:46 ` Junio C Hamano
2007-01-16  3:03   ` Jason Riedy [this message]
2007-01-16  3:09   ` Eric Blake
2007-01-17 16:29   ` Horst H. von Brand
2007-01-17 17:33     ` Junio C Hamano
2007-01-17 18:00       ` Brian Gernhardt
2007-01-17 18:07       ` Julian Phillips
2007-01-17 20:17         ` Horst H. von Brand
2007-01-18  0:02       ` Simon 'corecode' Schubert
2007-01-18  0:13         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18039.1168916633@lotus.CS.Berkeley.EDU \
    --to=ejr@cs$(echo .)berkeley.edu \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox