O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Background Jobs and I/O

Jobs being executed in the background will stop if they attempt to read input from your terminal. If you tried to interactively remove $PUBDIR/junk in the background, this is what would happen:

					$ rm —i $PUBDIR/junk &
					[2]  +Stopped (tty input) rm —i $PUBDIR/junk &
				

The job is stopped because it needs to prompt you for input. The rm –i job is brought back into the foreground with the fg command and its prompt is displayed:

					$ fg %2
					rm —i $PUBDIR/junk
					rm: remove /usr/spool/uucppublic/junk? y
				

By default, jobs send their output to your terminal, even while running in the background. Here, the find command sends its output to the terminal, even though it is running in the background:

					$ find / —name core —print &
					[2] 1453 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required