Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

migrated from stackoverflow.com Nov 23 '11 at 9:38

This question came from our site for professional and enthusiast programmers.

3 Answers 3

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.

share|improve this answer
    
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). –  Michael Kjörling Nov 23 '11 at 10:11

add an & at the end of the command

share|improve this answer

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

anycommand &
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.