I've always used shell scripting of various types and tend to work to whatever is available in the operating environments I'm working in.
If I'm doing stuff in Windows-land I'm going to use PowerShell because it's readily available and it's an "object"-ively good shell scripting language as it's tightly integrated with the OS (Windows treats everything as objects).
Bash is tightly integrated with the unix-like OS's where the OS treats everything as text and the shell scripting environment plays well with that. Trying to use PowerShell to integrate with tooling that assumes you want to always receive text can be a pain especially when it sends debug messages over stderr which PowerShell treats as an exception (looking at you git).
I still use pwsh on Linux for things like Github actions because being able to do something like this is nice considering how often you need to interact with JSON based apis, rather than getting the raw text of some json property using jq you get the actual type and can use .NET to deal with them:
$responseVariable = Invoke-RestMethod "https://jsonplaceholder.typicode.com/posts/1"
Write-Host "Title is '$($responseVariable.title)'"
Write-Host "Title is a '$($responseVariable.title.GetType())'"
Write-Host "UserId is '$($responseVariable.userId)'"
Write-Host "UserId is a '$($responseVariable.userId.GetType())'"
> Title is 'some text blah blah blah'
> Title is a 'string'
> UserId is '1'
> UserId is a 'long'
I think I've been using bash-like stuff for ~15 years and PowerShell for the last 3 and now that it's cross platform I reckon it's definitely worth having a look at, I wasn't so keen on learning when it only applied to Windows Server management.
I also just started using PowerShell around three years ago, when I started working in a Windows only environment. In the beginning I went through the whole circus with Cygwin, WSL, natively ported apps, etc. In the end I just decided to embrace PowerShell and it's really not bad. I quite like the object-oriented part of it.
I just installed PowerShell 7 last week to work on some scripts that required this, and I am hoping that some of the quirks of PowerShell have been solved in this version.
If I'm doing stuff in Windows-land I'm going to use PowerShell because it's readily available and it's an "object"-ively good shell scripting language as it's tightly integrated with the OS (Windows treats everything as objects).
Bash is tightly integrated with the unix-like OS's where the OS treats everything as text and the shell scripting environment plays well with that. Trying to use PowerShell to integrate with tooling that assumes you want to always receive text can be a pain especially when it sends debug messages over stderr which PowerShell treats as an exception (looking at you git).
I still use pwsh on Linux for things like Github actions because being able to do something like this is nice considering how often you need to interact with JSON based apis, rather than getting the raw text of some json property using jq you get the actual type and can use .NET to deal with them:
I think I've been using bash-like stuff for ~15 years and PowerShell for the last 3 and now that it's cross platform I reckon it's definitely worth having a look at, I wasn't so keen on learning when it only applied to Windows Server management.