Instead of waiting for slow commands to finish, I'd like to run them in the background. However, when they finish running and print to stdout, I get (where █ represents my cursor) this:
$ slowcmd &
$ cmd_output
█
- There is no prompt string before my cursor.
- and
slowcmdcan be any slow command (For the stuff I've tried, I just saidalias slowcmd='sleep 1 && echo cmd_output')
Whereas I'd like something like this:
$ slowcmd && redrawPromptString &
$ cmd_output
$ █
Where after the command's output, a new Prompt String is printed out for me.
What I can do to make redrawPromptString do what I want? I've tried clear, kill $$ to send a ^C to the terminal, and finally printf "^C" (of course that didn't work). I'm running bash. (GNU bash, version 3.2.57).