一个powershell
“hello world”脚本正在生成并使系统陷入困境:
Tasks: 413 total, 2 running, 411 sleeping, 0 stopped, 0 zombie
%Cpu(s): 42.8 us, 5.9 sy, 0.0 ni, 51.2 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 8126688 total, 1785632 free, 4862820 used, 1478236 buff/cache
KiB Swap: 8343036 total, 8343036 free, 0 used. 2875400 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11915 thufir 20 0 3199524 76936 54220 S 19.2 0.9 0:00.58 b.sh
11858 thufir 20 0 3068456 76988 54276 S 18.9 0.9 0:00.57 b.sh
11820 thufir 20 0 3199516 77008 54292 S 18.5 0.9 0:00.56 b.sh
11877 thufir 20 0 3330588 76796 54040 S 18.2 0.9 0:00.55 b.sh
11896 thufir 20 0 3199532 76984 54232 S 18.2 0.9 0:00.55 b.sh
11839 thufir 20 0 3199524 76808 54036 S 17.9 0.9 0:00.54 b.sh
11934 thufir 20 0 3199520 77152 54360 S 17.9 0.9 0:00.54 b.sh
10265 thufir 20 0 3609528 167556 83332 S 6.3 2.1 0:06.27 gnome-shell
10002 thufir 20 0 3447780 86904 61024 S 4.6 1.1 0:00.72 b.sh
9965 thufir 20 0 3447764 86904 61036 S 4.3 1.1 0:00.69 b.sh
9982 thufir 20 0 3316688 86380 60528 S 4.3 1.1 0:00.71 b.sh
10021 thufir 20 0 3447760 86548 60628 S 4.3 1.1 0:00.70 b.sh
10040 thufir 20 0 3316696 86316 60524 S 4.0 1.1 0:00.71 b.sh
10060 thufir 20 0 3316692 86680 60860 S 4.0 1.1 0:00.68 b.sh
10080 thufir 20 0 3447768 85824 60020 S 3.3 1.1 0:00.66 b.sh
9948 thufir 20 0 3447768 86788 60792 S 3.0 1.1 0:00.66 b.sh
11799 thufir 20 0 3068444 77012 54192 S 1.7 0.9 0:00.56 b.sh
剧本:
thufir@dur:~$
thufir@dur:~$ cat powershell/weather/b.sh
#!/usr/bin/pwsh -Command
echo "hello world"
"done"
thufir@dur:~$
不能让它成为一个可执行的脚本吗?也许这不是正确的第一行?
详细信息powershell
:
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 : 38ca179a-1605-49d3-8af2-15985d6c0536
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>
哎呀:
它只需要具有
.ps1
文件扩展名。微软。