Skip to content
Advertisement

Export variable containing special characters(args)

I want to export CELERY_ARGS

CELERY_ARGS="--prefetch-multiplier=1 --loglevel=info --concurrency=1"

But when I export, I get the following issue.

export $CELERY_ARGS
bash: export: --: invalid option
export: usage: export [-fn] [name[=value] ...] or export -p

Any suggestions. Thanks

Advertisement

Answer

Exporting isn’t something you do with a value; it’s something you do to a name.

export CELERY_ARGS

adds CELERY_ARGS to a list of variable names (if it isn’t already there) whose values should be added to the environment of a child process when it is started.

Note that this means it doesn’t matter what the value of CELERY_ARGS is when you export the name (or even if the variable is defined yet); the value received by the child process is the value at process creation.

For example,

$ printenv bar
$ bar=7
$ printenv bar
$ export bar
$ bar=9
$ printenv bar
9
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement