小编Sco*_*oPi的帖子

EL 5上/etc/init.d/functions中声明的含义

当谈到Bash shell脚本时,我对业余爱好者感到困惑,并且在CentOS 5.10系统的/etc/init.d/functions中的killproc()函数的第一行感到困惑:

local RC killlevel= base pid pid_file= delay try
Run Code Online (Sandbox Code Playgroud)

那条线是什么意思?我相信它可能是局部变量的声明,但是在几个项目之后=的含义是什么?我在下面包含了完整的killproc()函数以供参考:

# A function to stop a program.
killproc() {
    local RC killlevel= base pid pid_file= delay try

    RC=0; delay=3; try=0
    # Test syntax.
    if [ "$#" -eq 0 ]; then
        echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
        return 1
    fi
    if [ "$1" = "-p" ]; then
        pid_file=$2
        shift 2
    fi
    if [ "$1" = "-d" ]; then
        delay=$(echo $2 | awk -v RS=' ' …
Run Code Online (Sandbox Code Playgroud)

linux bash function init.d

3
推荐指数
1
解决办法
675
查看次数

标签 统计

bash ×1

function ×1

init.d ×1

linux ×1