Red Hat Bugzilla – Bug 1298499
q command does not immediately quit
Last modified: 2016-07-07 11:34:02 EDT
Description of problem:
The info page for sed says that the q command immediately quits. However, it doesn't.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
(echo 'PostgreSQL init process complete; ready for start up.'; sleep 3; echo foo)|sed -n -e '/PostgreSQL init process complete/q'
Output is correct (no output) but it takes 3 seconds
Should return instantly
Same bug happens with Q, or Q 1
sed does quit immediately, but the shell doesn't exit until the whole pipeline is done. Try this:
$ (echo 'PostgreSQL init process complete; ready for start up.'; sleep 3;
echo foo)|(sed -n -e '/PostgreSQL init process complete/q'; echo bar)
And you'll see that "bar" is printed immediately.