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
slowcmd
can 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).
\@
for the time. (But yeah, that is a suitable workaround for any sane person who doesn't care about getting exactly what he wants...) Ahaha but for real, I hate not being able to do what I want out of ignorance! Out of lack of support in the program I'm using? Sure (for now). But out of ignorance? I don't like that. I will google and stack overflow and ask everyone who I think might now until the cows come home.slowcmd
terminal? Use terminal multiplexer such astmux
, create new window and run thereslowcmd
while you can switch back to working terminal and continue your work.