pidofproc function with --pidfile options

Pawel Golaszewski blues w pld-linux.org
Sob, 14 Kwi 2007, 23:46:39 CEST


That patch is making the same but in much-much better way:

--- functions.org       2007-04-14 23:10:09.000000000 +0200
+++ functions   2007-04-14 23:41:17.000000000 +0200
@@ -666,10 +666,10 @@
                pidfile="/var/run/${pidfile}";
        fi
        if [ -f "${pidfile}" ] ; then
-               typeset line p pid
+               typeset p pid
                pid=
-               read line < "${pidfile}"
-               for p in $line; do
+               #line=`/bin/cat "${pidfile}"`
+               for p in $(< "${pidfile}"); do
                        [ -z "$(echo "$p" | awk '{gsub(/[0-9]/,"");print;}')" ] && pid="$pid $p"
                done
        fi

-- 
pozdr.  Paweł Gołaszewski          jid:blues<at>jabber<dot>gda<dot>pl
--------------------------------------------------------------------------
If you think of MS-DOS as mono, and Windows as stereo, then Linux is Dolby
Pro-Logic Surround Sound with Bass Boost and all the music is free.


Więcej informacji o liście dyskusyjnej pld-rc-scripts