in reply to sort system call problem with activestate perl

in windows, the default shell is cmd.exe, in cygwin its bash or csh or ...
  • Comment on Re: sort system call problem with activestate perl

Replies are listed 'Best First'.
Re^2: sort system call problem with activestate perl
by moritz (Cardinal) on Jul 03, 2008 at 13:23 UTC
    To elaborate a bit more: Windows handles `pwd` as a literal. Since it can't create a file in the directory `pwd` (because it doesn't exist), it fails.

    One workaround is to use Cwd to obtain the current working dir in a platform-independent way.

      Thank you Moritz,

      that makes sense. However, I don't really know how I can call Cwd from cygwin ("command not found" - I must have a thick day), but this works, working around the string literal issue:
      perl -e 'my $path = `pwd`; system "sort -T " . $path . " --buffer-size=10 ../somefile.txt"'
      
      thank you,
      bop

      PS: I forgot to mention previously that I use such a small buffer size in order to recreate the problem I had (but I'm sure you guessed that).
        However, I don't really know how I can call Cwd from cygwin

        I recommended the Cwd perl module, not a command. It's in core, use it ;-).