| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-ID: | <053001c3725a$bfe9cea0$c900000a@docbill002> |
| From: | "Bill C. Riemers" <cygwin AT docbill DOT net> |
| To: | "Garrison, Jim" <jim DOT garrison AT athensgroup DOT com>, <cygwin AT cygwin DOT com> |
| References: | <732AC39DA54C1C4FBCBCC2F853D3AB816D16F9 AT athensgroup-pc9 DOT athensgroup DOT com> |
| Subject: | Re: Strange cygpath/Perl 5.8 interaction? |
| Date: | Wed, 3 Sep 2003 16:33:47 -0400 |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165 |
It is not perl adding and extra line feed. It is bash automatically
removing a line feed...
i.e.
$ echo "|"`pwd`"|"
|/tmp|
$ pwd |od -t x1
0000000 2f 74 6d 70 0a
0000005
Bash will remove the \n for you automatically when using `pwd`, perl won't.
To tell perl to remove the trailing "\n" use the chomp function.
$ perl -e 'chomp($a=`pwd`);print "|".$a."|\n";'
|/tmp|
----- Original Message -----
From: "Garrison, Jim" <jim DOT garrison AT athensgroup DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Wednesday, September 03, 2003 4:13 PM
Subject: Strange cygpath/Perl 5.8 interaction?
> In bash:
>
> $ echo "\"`cygpath -w /c/temp`\""
> "c:\temp"
>
>
> But in Perl:
>
> $a = `cygpath -w /c/temp`;
> print "|$a|";
>
> produces
>
> |c:\temp
> |
>
> I.e., Perl sees an extra \n at the end of the string. I looked at
> the source for cygpath and it doesn't seem to be adding a \n, so
> I suspect the problem is an unforeseen interaction between Cygwin
> and Perl's backtick operator. Can anyone shed light on this topic?
>
> Jim Garrison
> jhg AT athensgroup DOT com
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Problem reports: http://cygwin.com/problems.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |