命令行参数中的“&”是什么意思?

时间:2018-03-27 08:15:42

标签: c linux signals

在“Linux编程接口”中有一个段代码:

static void
handler(int sig)
{
    ........
}

int
main(int argc, char *argv[])
{
    int n, numSecs;
    sigset_t pendingMask, blockingMask, emptyMask;

    printf("%s: PID is %ld\n", argv[0], (long) getpid());


    for (n = 1; n < NSIG; n++)          
        (void) signal(n, handler);      

    if (argc > 1) {
        numSecs = getInt(argv[1], GN_GT_0, NULL);

        sigfillset(&blockingMask);
        if (sigprocmask(SIG_SETMASK, &blockingMask, NULL) == -1)
            errExit("sigprocmask");

        printf("%s: sleeping for %d seconds\n", argv[0], numSecs);
        sleep(numSecs);

        if (sigpending(&pendingMask) == -1)
            errExit("sigpending");

        printf("%s: pending signals are: \n", argv[0]);
        printSigset(stdout, "\t\t", &pendingMask);

        sigemptyset(&emptyMask);         
        if (sigprocmask(SIG_SETMASK, &emptyMask, NULL) == -1)
            errExit("sigprocmask");
    }

    while (!gotSigint)                   
        continue;

    for (n = 1; n < NSIG; n++)           enter code here
        if (sigCnt[n] != 0)
            printf("%s: signal %d caught %d time%s\n", argv[0], n,
                    sigCnt[n], (sigCnt[n] == 1) ? "" : "s");

    exit(EXIT_SUCCESS);
}

按以下方式运行:

$ ./sig_receiver 15&amp;

如果按以下方式运行:

$ ./sig_receiver 15

我发现这两种方法没有区别。

“&amp;”是什么意思?

0 个答案:

没有答案
相关问题