Flethuseo
Flethuseo

Reputation: 6189

running nohup command on script that takes all parameters

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`

Upvotes: 14

Views: 27616

Answers (2)

JRFerguson
JRFerguson

Reputation: 7516

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

Upvotes: 1

Peter John Acklam
Peter John Acklam

Reputation: 363

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.

Upvotes: 12

Related Questions