9

I want to use watch jobs to see an updated showing of all the jobs I have running, but when I try to do it, all I get is the headline of watch and a blank screen. But using the script

while (1)
  sleep 10;
  clear;
  jobs;
end

does work, where is the problem?

SIMEL
  • 8,745
  • 28
  • 84
  • 130

2 Answers2

7

Job control is managed by the shell and jobs is a shell builtin function. If you use the command which jobs you will see there is no binary called jobs anywhere in your $PATH.

watch is doing a system call every two seconds so shell functions aren't available to it.

You could also try watch 'ps awwwux | grep yourusername'. But its not quite the same as jobs.

Eric Johnson
  • 17,502
  • 10
  • 52
  • 59
4

Job is not a system command its a shell command - when you start watch he executes a subshell which has its own job managment and of course no jobs. Try watch ps.

flolo
  • 15,148
  • 4
  • 32
  • 57