Shell公共函数库

Shell公共函数库

Linux系统里有一些公共的Shell函数库可供使用,最重要的是/etc/rc.d/init.d/functions,在/etc/init.d目录下有很多脚本都用到了这个函数库,里面提供了很多有用的方法,比如:killproc()等等。所以编写自己的Shell脚本时可以套用这个函数库:

if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi

posted @ 2013-05-22 12:24  中国公民  阅读(417)  评论(0)    收藏  举报