1

I find I frequently use the combination of Suspend (^Z) then send to background (bg) in bash. Ideally I would like an alternate keyboard shortcut that negates the need to follow ^Z with the bg command, and just send the active process straight to background. Does this exist?

Edit: I should have been more specific, but appending & to the command is not sufficient, as they often require interaction (stdin) between launch and backgrounding. So:

  1. launch
  2. interact
  3. background

3 Answers 3

3

Simply use the & char at the end of a line:

anycommand &
1

add an & at the end of the command

0

Since you require interaction with your script immediately after launching it, consider (if you can) enumerating the responses you will require in a file first (one response per line). Then, launch your script and redirect its STDIN from the response file.

1
  • Just be careful since, if the script tries to read from its standard input in this scenario past your "expected" inputs, it will get an EOF (and likely fail somehow, more or less gracefully, because of it).
    – user
    Nov 23, 2011 at 10:11

You must log in to answer this question.