CentOS7,Linux,rpm和yum,安装PowerShell

rpm安装
下载地址: https://github.com/PowerShell/PowerShell
下载文件: powershell-lts-7.2.7-1.rh.x86_64.rpm
安装:rpm -ivh powershell-lts-7.2.7-1.rh.x86_64.rpm

yum安装

curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
yum install -y powershell

查看系统支持的脚本

# 查看系统支持的脚本
cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh
/usr/bin/pwsh

# 执行脚本
 pwsh
PowerShell 7.2.7
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /root> 

执行脚本文件(hello.ps1)

#!/usr/bin/pwsh


$i = 1

echo $i
echo "hello world~"
~                    

执行:./hello.ps1

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容