* RE: Strange cygpath/Perl 5.8 interaction?
@ 2003-09-03 20:27 Bakken, Luke
0 siblings, 0 replies; 4+ messages in thread
From: Bakken, Luke @ 2003-09-03 20:27 UTC (permalink / raw)
To: Garrison, Jim, cygwin
lukeb@cbinfralxb ~
$ cygpath -w /c/temp | xxd
0000000: 633a 5c74 656d 700a c:\temp.
lukeb@cbinfralxb ~
$ echo "\"`cygpath -w /c/temp`\"" | xxd
0000000: 2263 3a5c 7465 6d70 220a "c:\temp".
lukeb@cbinfralxb ~
$ perl -e'$a=`cygpath -w /c/temp`;print "\"$a\""' | xxd
0000000: 2263 3a5c 7465 6d70 0a22 "c:\temp."
I'd say something was up with echo/bash, not with perl.
> -----Original Message-----
> From: Garrison, Jim [mailto:jim.garrison@athensgroup.com]
> Sent: Wednesday, September 03, 2003 1:13 PM
> To: 'cygwin@cygwin.com'
> 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@athensgroup.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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Strange cygpath/Perl 5.8 interaction?
@ 2003-09-03 20:13 Garrison, Jim
2003-09-03 20:30 ` Christopher Faylor
2003-09-03 20:34 ` Bill C. Riemers
0 siblings, 2 replies; 4+ messages in thread
From: Garrison, Jim @ 2003-09-03 20:13 UTC (permalink / raw)
To: 'cygwin@cygwin.com'
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@athensgroup.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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Strange cygpath/Perl 5.8 interaction?
2003-09-03 20:13 Garrison, Jim
@ 2003-09-03 20:30 ` Christopher Faylor
2003-09-03 20:34 ` Bill C. Riemers
1 sibling, 0 replies; 4+ messages in thread
From: Christopher Faylor @ 2003-09-03 20:30 UTC (permalink / raw)
To: cygwin
On Wed, Sep 03, 2003 at 03:13:01PM -0500, Garrison, Jim wrote:
>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?
I don't see anything unforeseen about the above behavior. Substitute
/bin/echo for the cygpath above and you'll see the same behavior on
UNIX.
cgf
--
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Strange cygpath/Perl 5.8 interaction?
2003-09-03 20:13 Garrison, Jim
2003-09-03 20:30 ` Christopher Faylor
@ 2003-09-03 20:34 ` Bill C. Riemers
1 sibling, 0 replies; 4+ messages in thread
From: Bill C. Riemers @ 2003-09-03 20:34 UTC (permalink / raw)
To: Garrison, Jim, cygwin
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.garrison@athensgroup.com>
To: <cygwin@cygwin.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@athensgroup.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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-09-03 20:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03 20:27 Strange cygpath/Perl 5.8 interaction? Bakken, Luke
-- strict thread matches above, loose matches on Subject: below --
2003-09-03 20:13 Garrison, Jim
2003-09-03 20:30 ` Christopher Faylor
2003-09-03 20:34 ` Bill C. Riemers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).