I'd love to see an example. Let's say I'm on a Debian server. How would I acquire Powershell (is it GPL/MIT?) and use it to convert some JSON?
Debian install instructions https://docs.microsoft.com/en-us/powershell/scripting/instal...
Enable https, add feed, apt install
As someone who started out scripting in Powershell but preferred Linux as an OS. I found myself missing powershell's object passing in opposition to bash's string passing.
That being said I now primarily use iPython for advanced shell tasks as I can leverage all of Python's libraries like JSON or YAML.
TBH they're both excellent choices. nushell looks really good too. The point is not to scrape text - rather than write a bash script that can handle JSON properly, write a pwsh/python/nushell script that handle everything properly (ie, by selecting fields rather than scraping text).
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/microsoft.list'
sudo apt-get update
sudo apt-get install -y powershell
I'm a node developer, here's what I used to find packages that had a cracked dependency recently: $results = @{}
ls -recurse -filter "eslint-scope" | foreach {
$file = "${PSItem}\package.json"
$version = cat $file | convertfrom-json | select -ExpandProperty version
$results.Add($file,$version) }
echo $results | format-list
PS. pwsh should really combine reading a file, determining it's type, and parsing it, into one command. Like: open $file | select -ExpandProperty version
I know I can make this, it just should be in the stdlib.