株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

LinuxにPowershellがインストールできるみたいなのでやってみた。
2016年8月にオープンソース化したみたい。
.NetFrameworkのオープンソース版の.NetCoreというものをベースにしたらしい。

公式ページ
https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#centos-7

#インストール
[root@docker ~]# curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
[root@docker ~]# yum -y install powershell

#シェルにログイン
[root@docker ~]# pwsh
PowerShell v6.1.0-preview.1
Copyright (c) Microsoft Corporation. All rights reserved.

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

#ディレクトリ一覧表示(ls)
PS /root> Get-ChildItem


    Directory: /root


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
------       2018/03/26      4:16           1389 anaconda-ks.cfg
------       2018/03/26     15:59      306402197 gitlab-ce-7.10.1~omnibus.2-1.x
                                                 86_64.rpm
------       2018/03/26      4:16           1523 original-ks.cfg

#ファイル作成(touch)
PS /root> New-Item test.txt


    Directory: /root


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
------       2018/03/26     16:28              0 test.txt

#ファイル追記
PS /root> echo "test" >> ./test.txt

#ファイル内容表示(echo)
PS /root> Get-Content ./test.txt
test

#ファイル削除(rm)
PS /root> Remove-Item ./test.txt

#シェル抜ける
PS /root> exit
[root@docker ~]#

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)