Add a new line to the result of the curl
Sometimes when we use curl to get result from a url, if the result has no empty line at the end, the next prompt of the terminal will…
Sometimes when we use curl
to get result from a url, if the result has no empty line at the end, the next prompt of the terminal will append after the result like below:
[root@localhost ~]$ curl https://essay.y9i.net/
OK[root@localhost ~]$
The url will return an OK
, and the second command line prompt will append to the end of the result like above.
I want to add a newline to the end of the result, let the new prompt at the separate line.
Solution
we can add -w "\n"
option to the curl command like below:
[root@localhost ~]$ curl -w "\n" https://essay.y9i.net/
OK
[root@localhost ~]$