Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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: <3EFDDF97.29F49125@dessent.net> Date: Sat, 28 Jun 2003 11:33:59 -0700 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,pdf MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: example needed pls: `cygpath -c ' References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Soren A wrote: > I am trying to finish a test script that uses ActivePerl to call `cygpath` > from itself (a system call, by open()-ing a pipe to capture the output of > the tool ... > > {... stuff ...} > open(CTH, '-|', "C:/cygwin/bin/cygpath $MS_path_filename") > or die "Could not open() call to 'cygpath', what is up?"; > $cygstyle_path = ; > chomp $cygstyle_path; > {... stuff ...} If $MS_path_filename is indeed a regular Windows filename (with backslashes) you will need to either use quotemeta() or s!\\!/!g because singular backslashes will be removed during interpolation. my $foo = quotemeta($MS_path_filename); chomp (my $cygpath = chomp `cygpath -u $foo`); # now $cygpath should be usable Here's a little thing I cooked up that I find very useful, I call it dodos. It lets you run any DOS/Windows program and call it with unix arguments. For example, you could type "dodos notepad /etc/aliases" or "dodos notepad /etc/hosts.*" and you'd get what you expect. #!/usr/bin/perl -w my @newargs = $ARGV[0]; foreach my $arg (@ARGV[1..$#ARGV]) { my $foo = quotemeta($arg); $foo = `cygpath -wsa $foo 2>/dev/null`; chomp $foo; push @newargs, $foo; } exec @newargs; Brian -- 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/