This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: New modes for cygpath that terminate path with null byte, nothing
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Fri, 27 Jul 2012 11:00:00 -0400
- Subject: Re: New modes for cygpath that terminate path with null byte, nothing
- References: <50124C62.9080405@dancol.org>
- Reply-to: cygwin-patches at cygwin dot com
On Fri, Jul 27, 2012 at 01:08:02AM -0700, Daniel Colascione wrote:
>I wrote this patch because I often write this:
>
>$ cygpath -aw foo > /dev/clipboard
>
>Today, cygpath always appends a newline to the information in the
>clipboard, which is annoying when trying to paste into a program that
>interprets newlines specially. This patch implements two new options:
>-0/--null and -n/--no-newline. The former separates all paths output by
>cygpath with a null byte; the latter separates them with nothing at all.
>With -n, my example above works more smoothly and pastes don't include a
>newline.
You could trivially accomplish these tasks with the use of 'tr':
cygpath -aw foo | tr -d '\n' > /dev/clipboard
cygpath -aw foo | tr '\n' '\0' >/dev/clipboard
cgf