Automatically add newline at end of curl response body

前端 未结 4 1982
-上瘾入骨i
-上瘾入骨i 2020-12-07 07:58

If the HTTP response body for a curl request doesn\'t contain a trailing newline, I end up with this really annoying condition where the shell prompt is in the middle of the

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 08:18

    The general solution for bash is to add a newline symbol into the command prompt:

    See related question (How to have a newline before bash prompt? ) and corresponding answer

    This solution covers each command, not only curl.

    echo $PS1 # To get your current PS1 env variable's value aka '_current_PS1_'
    PS1='\n_current_PS1_'
    

    The only side-effect is that you get command prompt after each 2nd line.

提交回复
热议问题