Skip to content

POSIX'ify, ZSH'ify & BASH'ify PowerShell? #9296

Closed

Description

@ylluminate

Make PowerShell not only POSIX compliant, but also ZSH & BASH compatible.

I don't want to start any kind of negative feedback loop here, but I'm thinking about a way for folks like me to give PowerShell a chance. I've used it off and on for years and each time I've used it I have always spit and cursed under my breath about how on earth could MS be pushing backwards vs forging ahead with a proven technology that sys admins and developers already know and love around the globe. I'm impressed that Microsoft is taking such steps as open sourcing this and I think this kind of an attempt at a visionary movement forward is both honorable and praiseworthy.

In an effort to unify the shell world, I think PowerShell could get really creative by providing a ZSH and BASH compatibility layer. Frankly I'd probably use PowerShell if I could do this as I'd feel good about it being supported by a serious, large and long term investor like Microsoft - even though it would be on macOS for my OS flavor.

So to this end, could you please implement a POSIX compliant layer in conjunction with ZSH and BASH compatibility that would allow us to bring our decades of accrued shell scripts and configurations over to PowerShell?

Activity

  1. added
    Issue-Enhancement
    on Apr 4, 2019
  2. iSazonov commented on Apr 5, 2019

    @iSazonov
    Collaborator

    please implement a POSIX compliant layer

    This has already been done. You can run these scripts from PowerShell just like any other application.

  3. added
    Resolution-Answered
    on Apr 5, 2019
  4. ghost closed this as completedon Jun 1, 2019
  5. KirkMunro commented on Jun 17, 2019

    @KirkMunro
    Contributor

    ylluminate (@ylluminate) Even though this has been marked as answered, I'd like to ask you a few questions if you're still paying attention to this thread.

    I've used it off and on for years and each time I've used it I have always spit and cursed under my breath about how on earth could MS be pushing backwards vs forging ahead with a proven technology that sys admins and developers already know and love around the globe.

    Can you go into a bit more detail on this point? What about it has made you "spit and curse" when using it? What makes you feel MS is pushing backwards vs forging ahead?

    In an effort to unify the shell world, I think PowerShell could get really creative by providing a ZSH and BASH compatibility layer.

    What does such a compatibility layer look like to you? Are there specific things you want added? If so, can you share some examples? Or did the replies above telling you that you could just invoke bash with an inline script really address your concerns? Since you didn't respond, I have no idea if that is all you were looking for or not.

    FYI, related to this topic, there are some discussions going on about adding language syntax that has bash users in mind. For example, this RFC that is currently in a PR. It proposes adding chaining via && and ||. If it's more features like those that you're looking for, what else?

  6. MyriaCore commented on Jul 13, 2020

    @MyriaCore

    Old post, but as far as I can tell, Powershell is NOT currently POSIX compatible, as Ilya (@iSazonov) suggested. I've been toying around with it since I've been trying out fvim on windows. There are basic POSIX things that aren't supported and just not there.

    To demystify what "POSIX compatibility" means for users like Kirk Munro (@KirkMunro), it basically just amounts to support for a subset of syntax and functionality called the POSIX Shell, which is laid out in this document. It includes things like, but not limited to:

    • $@, which is equivalent to $args
    • $1, $2, etc to get the first and second arguments, and so on
    • if / fi, case / esac syntax

    This syntax looks super fugly, especially for those who are used to the way PS does things. However, it's an important stepping stone, because it would attract people from the linux world who may have kept from switching to PS as their main scripting shell because their scripts wouldn't be guaranteed to run in PS.

  7. brandones commented on Mar 9, 2022

    @brandones

    PowerShell does not parse variable assignments in a POSIX-compliant way, see the same document linked above, section 2.9.1 Simple Commands. FOO=bar echo "$FOO" should print bar.

  8. redfave commented on Nov 22, 2024

    @redfave

    POSIX compatibility of PS would be a huge benefit in the long run, especially for dev teams using different operating systems.
    Git Hooks are a pain when they either only work on Unix bases Systems or Windows, just because PS is not POSIX compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementResolution-Answered

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions