Re: [RFC PATCHv3 1/4] am: avoid re-directing stdin twice

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

 



On 2014-09-06 09.34, Junio C Hamano wrote:
> Stephen Boyd <bebarino@xxxxxxxxx> writes:
> 
>>>> I see Stephen who wrote the original "Thunderbird save-as" is
>>>> already on the Cc list.  How about doing it this way instead?
>>
>> It was so long ago I can't even remember writing that patch. But I
>> googled the thread from 4.5 years ago and I see that you suggested we
>> use tr because \r is not portable[1].
> 
> Hmph.  That's unfortunate that this may be one of those things that
> even though it is in POSIX the real world prevents us from using it.
> 
> I wonder if things changed over the past four years, though.  Can
> folks on OSX or BSD do a quick check?
>
I may have missed the discussion, does this help?
"\r" can be used with tr, but not with sed:


tb@macosx:/tmp> cat ./xx.sh 
#!/bin/sh
which tr
printf "AB\rCD\n" | tr 'A\r\n\BCD' 'aRNbcd' | xxd
printf "E\rE" | tr -d '\r' | xxd
which sed
printf "AB\rCD\n" | sed -e  's/\r/R/g' | xxd
printf "E\rE" | sed -e 's/\r//g' | xxd

tb@macosx:/tmp> ./xx.sh 
/usr/bin/tr
0000000: 6162 5263 644e                           abRcdN
0000000: 4545                                     EE
/usr/bin/sed
0000000: 4142 0d43 440a                           AB.CD.
0000000: 450d 450a                                E.E.
tb@macosx:/tmp> 


--
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]