This is the mail archive of the
mailing list for the Cygwin project.
Re: Strange cygpath/Perl 5.8 interaction?
It is not perl adding and extra line feed. It is bash automatically
removing a line feed...
$ echo "|"`pwd`"|"
$ pwd |od -t x1
0000000 2f 74 6d 70 0a
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";'
----- Original Message -----
From: "Garrison, Jim" <email@example.com>
Sent: Wednesday, September 03, 2003 4:13 PM
Subject: Strange cygpath/Perl 5.8 interaction?
> In bash:
> $ echo "\"`cygpath -w /c/temp`\""
> But in Perl:
> $a = `cygpath -w /c/temp`;
> print "|$a|";
> 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
> 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