There are many solutions, but they also have some shortcomings:
sleep infinityis a top choice, but it is not supported by some libc/musl versions.sleep 100000dis good, but will eventually terminatetail -f /dev/nullwakes up each time some process drops something to /dev/null, and uses inotify resourcesecho 'void main(){ pause(); }' > pause.c; gcc pause.c -o pause; ./pauserequiresgccto be installed- piping from a halted shell with
sh -c 'kill -STOP $$' | program > outputwill keep going even after the program is terminated
A good alternative that avoids these limitations is waiting on a halted process:
while :; do :; done & kill -STOP $! && wait $!
The single ampersand & will put the while loop in the background. The kill will halt it using it’s process id. wait will wait on it indefinitely.