使用"perl6"在Windows上使用Git Bash命令 [英] Use "perl6" command with Git Bash on windows
问题描述
使用Windows,我安装了 Rakudo Star 和Git,并确保将C:\rakudo\bin
和C:\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
错误,在命令有效的情况下 在powershell
和cmd
中.在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屋!