From: Eric Blake <ebb9@byu.net>
To: Junio C Hamano <junkio@cox.net>
Cc: Jason Riedy <ejr@EECS.Berkeley.EDU>, git@vger.kernel.org
Subject: Re: [PATCH] Replace "echo -n" with printf in shell scripts.
Date: Mon, 15 Jan 2007 20:09:36 -0700 [thread overview]
Message-ID: <45AC41F0.8090106@byu.net> (raw)
In-Reply-To: <7v1wlv1yeh.fsf@assigned-by-dhcp.cox.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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 ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFrEHw84KuGfSFAYARAlH9AJ9q3atCpSVBTg0SVhZ4DQ9T7qiqEQCfe9D2
bGTfwnvW6uN1ky6ncWYgkgc=
=P9t5
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2007-01-16 3:09 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
2007-01-16 3:09 ` Eric Blake [this message]
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=45AC41F0.8090106@byu.net \
--to=ebb9@byu.net \
--cc=ejr@EECS.Berkeley.EDU \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).