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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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@xxxxxxx
-----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-----
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]