使用"perl6"在Windows上使用Git Bash命令 [英] Use "perl6" command with Git Bash on windows

查看:75
本文介绍了使用"perl6"在Windows上使用Git Bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows,我安装了 Rakudo Star 和Git,并确保将C:\rakudo\binC:\rakudo\share\perl6\site\bin放入我的路径环境变量.

Using Windows, I installed Rakudo Star and Git and ensured that C:\rakudo\bin and C:\rakudo\share\perl6\site\bin are in my Path environment variable.

现在,随后在Git Bash中键入perl6会出现command not found错误,在命令有效的情况下 powershellcmd中.在Git Bash中键入echo $PATH再次确认上面的文件夹也在我的path变量中.

Now, typing perl6 inside Git Bash afterwards gives the command not found error, while the command does work inside powershell and cmd. Typing echo $PATH inside Git Bash confirms again that the folders above are in my path variable here as well.

如何在Git Bash中使用perl6命令?

How can I get the perl6 command working inside Git Bash?

注意:在Git Bash中使用与perl6驻留在同一文件夹中的moar(moar.exe)也可以.同样点击Tab会显示moar的自动完成建议,而对于perl6则不会.

Note: Using moar (moar.exe) which resides in the same folder as perl6 works as well in Git Bash. Also hitting Tab show the autocomplete suggestion for moar, it does not do that for perl6.

推荐答案

Bash无法运行Windows批处理文件,因此您必须解决该问题.

Bash doesn't run Windows batch files, so you'll have to work around that.

一个简单的解决方案可能是在您的.bashrc中添加以下内容:

An easy solution might be to add something like this you your .bashrc:

alias perl6='cmd /c perl6.bat'

或者,您可以将perl6.bat转换为shell脚本,并将其放置在$PATH中的某个位置. 我使用以下内容:

Alternatively, you can convert perl6.bat to a shell script and put it somewhere in your $PATH. I use the following:

#!/bin/sh

PATH=/cygdrive/c/rakudo/bin:/cygdrive/c/rakudo/share/perl6/site/bin:$PATH
unset HOME

moar --execname="$0" \
     --libpath='C:\rakudo\share\nqp\lib' \
     --libpath='C:\rakudo\share\perl6\lib' \
     --libpath='C:\rakudo\share\perl6\runtime' \
     'C:\rakudo\share\perl6\runtime\perl6.moarvm' \
     "$@"

这是使用Cygwin;您可能需要对它进行一些调整以适应Git bash(我不知道,没有经验).

This is using Cygwin; you may need to adapt it a bit for Git bash (I don't know, no experience with it).

或者,如果您使用的是Windows 10,我建议您安装WSL,并在WSL bash提示符中使用perl6.对于我来说,这比Cygwin下的Windows版本更加顺畅.

Alternatively, if you're using Windows 10, I can recommend installing WSL, and using perl6 in a WSL bash prompt instead. This runs much smoother for me than the Windows version under Cygwin.

这篇关于使用"perl6"在Windows上使用Git Bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆