Hi,

I have a little problem with this fish script:

--8<---------------cut here---------------start------------->8---
#!/bin/fish

set -l TITLE ""

cpubar > ~/.cpubar.log &

# the while has to run in a new subshell so that its output goes into
# the pipe directly. Else the output would be blocked till the while
# finishes.
fish -c 'while true;
  # notifications
  set TITLE (status-show)
  # dnamicLog stuff
  set TITLE $TITLE "|" (tail -n 1 ~/.xmonad.log)
  # battery
  set TITLE $TITLE "|" (battery-status)
  # cpubar
  set TITLE $TITLE "|" (tail -n 1 ~/.cpubar.log)
  # cpufreq
  set -l cpufreq ""
  set -l i 0
  set -l lines (cat /proc/cpuinfo | grep "cpu MHz" | \
                sed -e "s/^.\+: //" | sed -e "s/\.[0123456789]*//")
  for l in $lines
    set cpufreq $cpufreq "CPU$i: $l"
    set i (echo $i+1 | bc)
  end
  set TITLE $TITLE "|" $cpufreq
  # date
  set TITLE $TITLE "|" (date "+%a %F %T")

  echo $TITLE

  sleep 1
end' | dzen2 -p -ta r -fn fixed -fg '#FFFFFF' -bg '#3F4C6B' -e \
  'button3=exec:urxvt.sh;entertitle=uncollapse,unhide;leavetitle=collapse'

killall cpubar
--8<---------------cut here---------------end--------------->8---

My problem is, that I want to kill all programs started with this script
when the script is killed, too.

Currently only cpubar is killed then, but dzen2 and the subshell running
the while loop go on. Because there are many fish shells and sometimes
more than one dzen2 running, I cannot kill them by name.

So is there a way to get the pid of a prozess when or after I started
it? Something like $_, but with the pid of the process would be great.

Thanks,
Tassilo
-- 
      "DRM manages rights in the same way a jail manages freedom"


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to