Results 1 to 3 of 3
What I am trying to do is write a script that will execute a few processes running in the background. This part is easy enough. However, what I want to ...
- 08-05-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 2
Switch a process to foreground by PID?
What I am trying to do is write a script that will execute a few processes running in the background. This part is easy enough. However, what I want to do after that at some point is switch these to the foreground so I can give input through the keyboard. However, when I do the 'jobs' command, these processes do not appear, though they do appear when I do 'ps'.
So basically, what I want to do is bring a process to the foreground by using its PID. Is this possible, or is there another way around this?
Thanks for your replies.
- 08-05-2007 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Hi,
The script which started the others processes is running in another shell and you can only manage background processes which started in the current shell.
Try to run the script in the current shell as follow:
instead of:Code:. ./scriptname
RegardsCode:./scriptname
- 08-05-2007 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 2
Hi Franklin, what you said worked perfectly. Thanks a lot!
A note for anyone else who had this problem (someone else please correct me if necessary) - at first I had "permission denied" when I tried this, but when I ran another shell within my current one, and ran the script from there, I had no problems.


Reply With Quote