This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Direct/efficient way to chop off trailing \n


Eric Blake sent the following at Wednesday, October 01, 2014 10:33 PM
>On 10/01/2014 08:25 PM, Eliot Moss wrote:
>
>> You could write my solution as:
>>
>> echo -n `cygpath -aw foo`>/dev/clipboard
>
>'echo -n' is not portable (in fact, you can disable it in bash, and it
>may misbehave if cygpath outputs a leading - or contains any \); it's
>better to use 'printf' for that purpose:
>
>printf %s `cygpath -aw foo`>/dev/clipboard
>
>> The echo solution has the good property that echo is
>> a shell built-in and so does not require spawning
>> another process.
>
>The same is true of printf.

Converting \n line endings to \r\n might work for you when you paste
into a Windows app.  It does for me.

cygpath -aw foo/bar | putclip -d

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]