Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/132.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在CLion中测试shell(.sh)文件_C++_Powershell_Intellij Idea_Ide_Clion - Fatal编程技术网

C++ 在CLion中测试shell(.sh)文件

C++ 在CLion中测试shell(.sh)文件,c++,powershell,intellij-idea,ide,clion,C++,Powershell,Intellij Idea,Ide,Clion,我正在使用Clion,我不确定如何使用我的代码运行.sh文件。这是一个作业,我必须运行一个自动测试来测试我的代码 这就是它的名称:$。/test\u p2.sh 2 我的代码所在的文件夹中有shell文件,但在可执行或工作目录中看不到它 感谢您的帮助!谢谢您不能在Windows上直接运行Linux shell脚本。但是,您有几个选择: 通过Cygwin运行脚本 在mintty中运行脚本(这是Git for Windows附带的shell,在上下文菜单中称为Git Bash) 在WSL(Windo

我正在使用Clion,我不确定如何使用我的代码运行.sh文件。这是一个作业,我必须运行一个自动测试来测试我的代码

这就是它的名称:
$。/test\u p2.sh 2

我的代码所在的文件夹中有shell文件,但在可执行或工作目录中看不到它


感谢您的帮助!谢谢

您不能在Windows上直接运行Linux shell脚本。但是,您有几个选择:

  • 通过Cygwin运行脚本
  • 在mintty中运行脚本(这是Git for Windows附带的shell,在上下文菜单中称为
    Git Bash
  • 在WSL(
    Windows Subsystem for Linux
    )下运行脚本
  • 将脚本移植到可以在Windows上运行的另一种语言

  • 对于1和2,您需要确保脚本的任何依赖项在Cygwin或mintty中都可用

    对于3,在确保设置WSL后,可以在WSL下运行单个命令:
    WSL script.sh arg1 arg2 argX


    我建议选择3或4。3可能会提供兼容性和易设置性方面的最佳体验(无需移植脚本),因为Cygwin和mintty在其中设置依赖项可能会很麻烦。不过,只要您精通PowerShell和shell脚本,并且能够将等效调用从一个转换到另一个,选项4将是最好的选择。

    谢谢,这是有意义的。我将使用选项一,因为我已经有了Cygwin