【问题标题】:How to reconcile Strawberry perl with Cygwin?如何调和草莓 perl 与 Cygwin?
【发布时间】:2016-07-13 00:49:58
【问题描述】:

我在 Windows7 上使用 Strawberry perl,因为它的 cpanm 可以构建和安装 XS 模块。我也有cygwin。

我想在 cygwin Bash 中运行“wdq”perl 脚本,因为该脚本使用 ANSI 颜色。脚本以

开头
#!/usr/bin/env perl

当启动时,失败并显示

Can't open perl script "/cygdrive/c/Strawberry/perl/site/bin/wdq": No such file or directory

正如What is the reason for this "Can't open perl script : No such file or directory" 中解释的那样,原因是Strawberry 不理解cygwin 路径。

解决此问题的最简单方法是什么?需要在 bash 中设置不同的 PATH 吗?

【问题讨论】:

  • 我知道我可以运行“perl -S wdq”,但我很懒,只喜欢“wdq”:-)

标签: bash perl cygwin


【解决方案1】:

替换

#!/usr/bin/env perl

#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -wS "$( cygpath -u "$0" )" ${1+"$@"}'
    if 0;

【讨论】:

  • 这行得通,但我不得不使用 cygpath -u 而不是 cygpath -w 。谢谢!
  • @Vladimir Alexiev,已修复
猜你喜欢
  • 2011-12-14
  • 2012-05-27
  • 2014-11-20
  • 1970-01-01
  • 1970-01-01
  • 2015-11-16
  • 1970-01-01
  • 2020-04-21
  • 1970-01-01
相关资源
最近更新 更多