This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Direct/efficient way to chop off trailing \n
- From: Gary Johnson <garyjohn at spocom dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 1 Oct 2014 16:06:38 -0700
- Subject: Re: Direct/efficient way to chop off trailing \n
- Authentication-results: sourceware.org; auth=none
- References: <loom dot 20141001T235147-60 at post dot gmane dot org> <542C854D dot 3050001 at jhmg dot net>
On 2014-10-01, Jim Garrison wrote:
> On 10/1/2014 2:52 PM, Paul.Domaskis wrote:
> > Running bash in a Windows environment, I often find the need to
> > generate a full Windows path to a file so that I can access the file
> > from a Windows app.
> [snip]
> >... but it does remove the trailing \n which chokes up
> > Windows.
>
> Sounds like cygpath needs a "-n" option which eliminates the
> trailing newline.
The trouble with that is that the "problem" is common to (almost?)
all Unix commands, not just cygpath. That is, they all send their
output to stdout as lines of text, each line terminated by a
newline, as it should be. You can send the output of any command to
/dev/clipboard and it will be terminated by a newline. If that's
not desired, then one needs to take extra steps in the pipeline,
which is what tr is for.
Another solution would be to wrap the redirection to /dev/clipboard
in a function or script that takes your "-n" option and pipe the
output of cygpath or whatever command to that wrapper.
Regards,
Gary
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple