I'm having some hard time turning an output that contains single quotes ('') into a variable. The output is this:
Warning: Invalid character is found in given range. A specified range MUST
Warning: have only digits in 'start'-'stop'. The server's response to this
Warning: request is uncertain.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{
"total": 2,
"subtotal": 2,
"page": 1,
...
I think that problem is in the first single quotes. I've already tried creating the variable with single quotes, using @''@, @(''), but none of this forms is working. How can I put this in a variable?
CodePudding user response:
here-string with single quote will work, see: Here-strings
$x = @'
Warning: Invalid character is found in given range. A specified range MUST
Warning: have only digits in 'start'-'stop'. The server's response to this
Warning: request is uncertain.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{
"total": 2,
"subtotal": 2,
"page": 1,
...
'@
$x
results:
PS C:\> $x Warning: Invalid character is found in given range. A specified range MUST
Warning: have only digits in 'start'-'stop'. The server's response to this
Warning: request is uncertain.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{
"total": 2,
"subtotal": 2,
"page": 1,
...