【发布时间】:2020-01-02 09:44:31
【问题描述】:
我同时使用PowerShell 和PowerShell Core。
并非我为“大”PowerShell 编写的所有脚本都在 PowerShell Core 中工作,反之亦然。
为了避免混乱,我在考虑是否应该使用两个文件扩展名:
-
.ps1: PowerShell -
.pwsh: PowerShell 核心
在 Windows 中,扩展比在 shebang (#!/bin/mytool) 有助于解决问题的 Unix 系统中更为重要。 p>
使用两个扩展是“最佳实践”还是有更好的选择?
附加:我不确定当我从命令行/终端调用脚本时,.pwsh 脚本是否会被 PowerShell 执行。
我在 Unix / Linux 上下文中发现了一个类似的问题。 https://unix.stackexchange.com/questions/182882/use-sh-or-bash-extension-for-bash-scripts
【问题讨论】:
标签: powershell file-extension powershell-core