wsl -h
显示以下内容:
--exec, -e <CommandLine> Execute the specified command without using the default Linux shell.
-- Pass the remaining command line as is.
“不使用默认的Linux shell”是什么意思(即,如果不使用默认的shell,它还将使用什么?)。
此外,作为示例,我现在有三种可能的方法来从我的PowerShell提示符运行Linux ls
(即,这将不是ls
的Get-ChildItem
别名,而是通过WSL的Linux命令):
PS C:\> wsl -e ls # Alternatively, wsl --exec ls
PS C:\> wsl -- ls
PS C:\> wsl ls
但是所有的输出似乎都是一样的。您如何解释这三种从PowerShell提示符运行WSL Linux命令的方式之间的区别?
发布于 2021-02-11 19:37:54
我认为这意味着wsl运行命令directly
,而不是产生一个外壳进程来运行该命令。
例如,如果我运行:
wsl -e sleep 10
在另一个终端上,我有:
root 1482 1 0 11:32 tty3 00:00:00 /init
ubuntu 1483 1482 0 11:32 tty3 00:00:00 sleep 10
我们可以看到/init
是sleep 10
的父类,中间没有外壳。
https://stackoverflow.com/questions/66150671
复制相似问题