Is it possible??

I have following script..

which print date on screen continuously..
i start it on command line..
once its started it will go on...

IS THERE ANY WAY TO SEND TO TO BACKGROUND ONCE ITS STARTED???

thanks,
vidya...

Because you have the date command which wants to write to stdout, without redirecting the date command you will get a SIGTTOU.

What are you trying to do? make some kind TSR program that shows time?

You can cheat and create a screen (GNU screen) before starting the script and then detaching from the screen: Ctrl-A, d.

You also really should put a "sleep 1" in the loop, as executing the date program non-stop like that will eat up your CPU cycles like crazy.

No point in printing the time zillions of times every second.

If all you want is a digital display of the current time, consider using xclock like so: xclock -digital -update 1 &

guys guys..
it was just a example..

yes, its definitely possible

switching process between background and foreground is definitely possible

how??

press ctrl + z, it will pause the program... then fire command 'bg'
it will start the program agin in background.
to see program running in background fire commands jobs ,
to bring back the program in foreground fire command fg.
man pages can tell you more on this .. how to bring specific program to for ground .

while :
do
date &
done

man bg

when any process is running stop the process by pressing ^z (ctrl+z). then it gives the job no.
then u can switch it to back ground by typing command bg %job_number (ex: bg %1)
if u want to get it back to foreground type fg %1.
try this...