我正在尝试重构如何使用 NPPExec 从 Notepad++ 中在我的 Windows 机器上执行 bash shell .sh
文件。 (我以前成功过,但是我的硬盘坏了,我不记得我以前是怎么做的。)
以前工作时,我会运行调用 .sh
文件的 NPPExec 脚本,它向我展示了 Notepad++ 中处理 .sh 文件的控制台输出,就好像它正在处理赛格温。
这是我尝试开始工作的示例 .sh 文件:
message="Testing"
echo $message
此文件位于 C: 的根目录中。
失败的尝试:
以下三种方法都不行:
- 执行:
C:\nppexec.sh
响应:
CreateProcess() failed with error code 193:
%1 is not a valid Win32 application.
- 执行:
npp_exec C:\nppexec.sh
响应:
message="Testing"
CreateProcess() failed with error code 2:
The system cannot find the file specified.
$message
添加
#!/bin/bash
到 .sh 文件作为第一行只会在运行 npp_exec 时导致额外的错误:NPP_EXEC: C:\nppexec.sh #! /bin/bash CreateProcess() failed with error code 2: The system cannot find the file specified.
最佳答案
解决方案是直接调用 bash:
C:\cygwin\bin\bash --login -c "command.sh"
关于bash - 使用 NppExec(和 Cygwin)在 Notepad++ 中的 Windows 上运行 bash shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11234289/