Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.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
如何在Linux中从PowerShell内核执行Bash脚本_Bash_Powershell_Shell_Powershell Core - Fatal编程技术网

如何在Linux中从PowerShell内核执行Bash脚本

如何在Linux中从PowerShell内核执行Bash脚本,bash,powershell,shell,powershell-core,Bash,Powershell,Shell,Powershell Core,我有一个bash脚本foo.sh,我想用PowerShell Core中的一些参数--bar执行它。这不起作用: ./foo.sh 使用&运算符 & "./foo.sh" 或者使用bash执行它 & bash "./foo.sh" 事实证明,您也可以只执行/foo.sh。使用和“/foo.sh”或/foo.sh只需在我的系统的文本编辑器中打开foo.sh即可。要实际运行脚本,我必须使用:&bash./foo.sh“

我有一个bash脚本
foo.sh
,我想用PowerShell Core中的一些参数
--bar
执行它。这不起作用:

./foo.sh
使用&运算符

& "./foo.sh"
或者使用bash执行它

& bash "./foo.sh"

事实证明,您也可以只执行
/foo.sh
。使用
和“/foo.sh”
/foo.sh
只需在我的系统的文本编辑器中打开foo.sh即可。要实际运行脚本,我必须使用:
&bash./foo.sh“