以下内容来自RHEL上的/etc/init.d/functions.我试图找出__pids_var_run()当我遇到这个while循环时函数的作用.
while : ; do
read line
[ -z "$line" ] && break
for p in $line ; do
if [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] ; then
if [ -n "$binary" ] ; then
local b=$(readlink /proc/$p/exe | sed -e 's/\s*(deleted)$//')
[ "$b" != "$binary" ] && continue
fi
pid="$pid $p"
fi
done
done < "$pid_file"
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下while : ; do ; ... done < "$pid_file"吗?更具体地说,之后的最后一部分done,其余部分或多或少都是有道理的.