4 ms·
PowerShell is great -- but there are some things you simply cannot do with it. For example, try to escape '$', which can be included in urls but can't be used i
by felsokning 2y ago
PowerShell is great -- but there are some things you simply cannot do with it. For example, try to escape '$', which can be included in urls but can't be used in Invoke-RestMethod.
Bash via WSL saves the day, in this regard (e.g.: $results = wsl ./myAwesomeBashScript.sh).
While PowerShell is great as object-oriented scripting, it still can't handle simple tasks that can be done in the likes of bash, zsh, etc.
- jborean93 2y agoTo escape $ you either need to use a single quoted string so the $ is treated literally or in a double quoted string use a backtick before the $ to escape it Write-Host 'Foo$Bar' Write-Host "Foo`$Bar"
- RajT88 2y agoA lot of people's complaints in this thread are because they just haven't figured out the powershell way of doing that thing. Granted - the Powershell way of doing some things is stupidly obtuse sometimes.
- felsokning 2y agoIn the issue I ran into, the '$' comes back from Azure in the nextLink[1] value. As soon as you try to process the string, the reserved token '$' breaks any processing - precisely because it wasn't escaped before being stored. Perhaps, it's easy enough to do some .NET manipulation, just to get PowerShell to be able to handle the string for the next Invoke-RestMethod -- but its far easier to just curl those urls, instead. [1] - https://learn.microsoft.com/en-us/rest/api/keyvault/keyvault/vaults/list?view=rest-keyvault-keyvault-2022-07-01&tabs=HTTP#examples https://learn.microsoft.com/en-us/rest/api/keyvault/keyvault...