LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ps/jobs in shell script (https://www.linuxquestions.org/questions/linux-newbie-8/ps-jobs-in-shell-script-316007/)

paraiso 04-22-2005 06:59 AM

ps/jobs in shell script
 
Hi!

How it comes that for instance :
Code:

ps
works in a bash shell script but not:

Code:

jobs
The jobs command doesn't execute when it's in a shell script :( I need to prints the names of jobs at the background.

ksgill 04-22-2005 07:06 AM

[quote]The jobs utility shall display the status of jobs that were started in the current shell environment; see Shell Execution Environment . [\quote]

That was taken from the man pages, jobs command only displays status of jobs started in the current shell, not the processes. If you wanna print the proicesses toa text file, you can do something like this: ps -r >file.txt
-r argument is to restrict the selection only to the running processes.

paraiso 04-22-2005 07:40 AM

Around 5 minutes to answer to my post that's fast! I like this forum more and more.
First Thanks ksgill for replying so fast and my other question is:
How do I display only the background processes with ps command? ps -a displays all the running processes but what about only the ones on the background ?

ksgill 04-22-2005 09:04 AM

I am not sure if there is a simple command to do that. I couldnt find an option of ps which would show just the background processes.. hopefully someone else know :D


All times are GMT -5. The time now is 06:01 PM.