Linux: Как отобразить вывод обеих команд who и pwd с помощью 1 команды [closed]

En Ubuntu parece que funciona bien:

thufir@dur:~$ 
thufir@dur:~$ pwsh
PowerShell v6.0.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /home/thufir> 
PS /home/thufir> $PSVersionTable.PSVersion                                                                              

Major  Minor  Patch  PreReleas BuildLabel 
                     eLabel               
-----  -----  -----  --------- ---------- 
6      0      1                           


PS /home/thufir> 
PS /home/thufir> get-host                                                                                               


Name             : ConsoleHost
Version          : 6.0.1
InstanceId       : 914b71f4-0e73-461c-b1c3-f04753e5ed34
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-CA
CurrentUICulture : en-CA
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace



PS /home/thufir> 
PS /home/thufir> $PSVersionTable                                                                                        

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      6.0.1                                                                                   
PSEdition                      Core                                                                                    
GitCommitId                    v6.0.1                                                                                  
OS                             Linux 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018                     
Platform                       Unix                                                                                    
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 
WSManStackVersion              3.0                                                                                     


PS /home/thufir> 
PS /home/thufir> exit                                                                                                   
thufir@dur:~$ 
thufir@dur:~$ pwsh hello_world.ps1 
hello powershell world
thufir@dur:~$ 
thufir@dur:~$./hello_world.ps1 
hello powershell world
thufir@dur:~$ 
thufir@dur:~$ cat hello_world.ps1 
#!/usr/bin/pwsh -Command


"hello powershell world"
thufir@dur:~$ 

tendrás que aclarar el problema. ¿No puede encontrar la versión para pwsh?

-4
15.11.2018, 15:42
1 ответ

Оператор &не имеет ничего общего с выполнением двух команд, см. этот вопрос .

Чтобы выполнить две разные команды в одной строке, используйте соответствующий разделитель;:

who; pwd

1
28.01.2020, 05:20

Теги

Похожие вопросы