![`powershell -version`이 Linux에서 작동하지 않습니다.](https://linux55.com/image/93484/%60powershell%20-version%60%EC%9D%B4%20Linux%EC%97%90%EC%84%9C%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
방금 설치했어요Linux용 PowerShell의 오픈 소스 버전아치 리눅스에서 사용이것powershell-git팩~에서우레아 소변 비율. PowerShell -Version
기능을 시도하면 다음 메시지가 나타납니다.
PS /home/user> powershell -Version 5.1
-Version : The term '-Version' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -Version 5.1
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-Version:String) [], CommandNot
FoundException
+ FullyQualifiedErrorId : CommandNotFoundException
이 문제를 어떻게 해결하나요?
답변1
PowerShell은 Windows용으로 작성되었으며 기본 파일 시스템이 대소문자를 구분하지 않는다고 가정합니다. PowerShell 명령을 입력하면 프로그램은 입력한 내용을 읽고 실제로 발생하는 상황과 일치시킵니다.~해야 한다존재하고 그것을 다시 나타내십시오.
이것PowerShell에 대한 도움말 메시지이 옵션은 다음과 같이 표시됩니다.-Version
:
-Version
Starts the specified version of Windows PowerShell.
Enter a version number with the parameter, such as "-version 2.0".
오류 메시지는 파일 시스템의 완전한 철자 이름 개념을 사용하여 일치하는 항목을 찾을 것으로 예상함을 나타냅니다. 도움말 메시지에 표시된 대소문자를 혼합한 이름을 사용하면 더 나은 성공을 거둘 수 있습니다.
답변2
우분투에서~인 것 같다정상적인 작업:
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:~$
이 문제를 명확히 해야 합니다. 버전을 찾을 수 없나요 pwsh
?