From: Marc Heiler Date: 2012-04-10T19:22:58+09:00 Subject: Bash - "jobs -l" command from ruby. HMmmmm. Hi, My situation: In bash, I start jobs and tasks etc... These all get a PID. Now with the command: jobs -l I can list these and get their PIDs. This command gives me a list like this (example): [1] 24056 Stopped (signal) tt++ /tmptintin/run.tin (wd: /) [2] 24816 Stopped (signal) tt++ /tmptintin/run.tin (wd: /depot/RUBY/TOOLS) [3] 7660 Stopped (signal) tt++ /tmptintin/run.tin (wd: /) [4] 28912 Stopped (signal) tt++ /tmptintin/run.tin (wd: /depot/RUBY/test) [5]- 21064 Stopped (signal) tt++ /tmptintin/run.tin (wd: /) [6]+ 7242 Stopped (signal) tt++ /tmptintin/run.tin (wd: /depot/RUBY/foo) Ok you see six jobs. I get all the PIDs there, for example, the last job has the PID 7242. I can then kill this process like so: kill -9 7242 But from within a .rb script this does not seem to work. I need to get the PID of the last executed program somehow, but only those started from an instance of bash (I embed my bash into konsole tabs, they all have different jobs of course) system 'jobs -l' Does not work, neither does result = `jobs -l` command not found: jobs -l It fails because jobs is a bash internal command. :( Is there any other way I can find out the PIDs of the jobs that were started from that bash instance? -- Posted via http://www.ruby-forum.com/.