문제

I am trying to run a script with nohup, but the command happens to take an entire line of parameters with the variable $*. I try running the command like this:

    nohup time ./build_all all &

But this is giving me the following error in nohup.out:

./build_all: DISPLAY=ted:0.0: is not an identifier

Any help appreciated.

Ted

==================================================================================

I realize that Peter John Acklam was right. The error is not because of nohup, but because of the script, I am not sure what I am doing wrong because the syntax seems correct to me. It is also kind of strange that when I run the script on its own, I don't see the error, but when I try to run with nohup, I see the strange error.

Anyhow, the beginning of the script looks like this:

#!/bin/bash

export DISPLAY=ted:0.0 # sets the display
export RELEASE=v1.0

node=`uname -n`
도움이 되었습니까?

해결책

Simply place the arguments to “build_all” on the command line, as for any other command:

nohup time ./build_all args to build_all go here &

and the arguments will be passed to “build_all”, not to “time” or “nohup”. The ampersand will be interpreted correctly by the shell, and will not be passed as an argument to any of the commands.

다른 팁

The script arguments (parameters) simply follow the script's name and preceed the ampersand.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top