Carriage return `\r` being appended to the output
See original GitHub issueThis is autogenerated. Please review and update as needed.
Describe the bug
Getting the following error when trying to query the IP address of a NIC for which I had already pulled the ID and sent as a parameter in the show command. Operation failed with status: ‘Bad Request’. Details: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/......./resourceGroups/......./providers/Microsoft.Network/networkInterfaces/…?api-version=2020-04-01
Command Name
az resource show
Errors:
az: error: unrecognized arguments: \ \ \
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here…
az resource show --name {} {} --resource-group {} {} --resource-type {} {} --query {} -o {}
Expected Behavior
Environment Summary
Windows-10-10.0.17763-SP0
Python 3.6.6
Installer:
azure-cli 2.6.0
Extensions:
interactive 0.4.4
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
Carriage return \r on bash script - Stack Overflow
I have this bash script on my CentOS 5.3. ... I've noticed that "\r" output is attached on the value. I would appreciate...
Read more >In shell scripting, how do I add carriage return to the output ...
In BASH, for example, you can output a carriage return character with: echo -e -n “\r” ... echo -n "${OUT}" >> file #...
Read more >Carriage return with echo command - Unix Stack Exchange
The \r is just that, a "carriage return" - nothing else. This means what is after the \r will overwrite the beginning of...
Read more >Remove "\r" from echoing out in bash script - Super User
I came across this problem when using cygwin bash against output from the standard (non-cygwin) version of python; I'm confused as to why...
Read more >How to remove carriage return in Linux or Unix - nixCraft
Removing carriage return in Linux or Unix · Open the terminal app and then type any one of the following command. · Use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’ve run into the same issue. I followed the following example:
https://docs.microsoft.com/en-us/azure/event-grid/custom-event-to-queue-storage#subscribe-to-a-custom-topic
so I had a script like:
what resulted in
Operation failed with status: 'Bad Request'. Details: 400 Client Error: Bad Request for url:
because of%0D
character in the middle of URL. I have workaround this by adding| tr -d '\r'
here:There are 2 ways to trigger this issue on WSL.
Calling
az
installed on WindowsIf you are calling
az
installed on Windows system instead of theaz
installed on WSL Linux, you will hit this issue.To identify which
az
you are calling, runCall
az
installed on Windows, save the result and letpython3
help us display its raw value:Solution
Always stay in WSL Linux. Make sure
az
is installed following Install the Azure CLI on Linux and/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin/az
is not called.Now it works correctly:
Executing
.sh
script withCRLF
As @zhoxing-ms stated in https://github.com/Azure/azure-cli/issues/13573#issuecomment-650686531, say we have
test.sh
withCRLF
as End of Line Sequence:When executing the script in WSL:
Solution
To fix it, you may open the script with VS Code:
Select End of Line Sequence and change it to
LF
:Now it works correctly: