How to pass variable to command executed by run-one?
This will do it, but I'm not sure if invoking /bin/sh launches a new process to do so, and want to keep system resource usage as minimal as possible:
$ /usr/bin/run-one /bin/sh -c 'DEBUG=n TEST=n /usr/local/
The following fail because run-one tries to create a lock on the first parameter passed to /usr/bin/run-one:
$ /usr/bin/run-one DEBUG=n TEST=n /usr/local/
flock: DEBUG=n: No such file or directory
$ /usr/bin/run-one 'DEBUG=n TEST=n /usr/local/
flock: DEBUG=n TEST=n /usr/local/
The following fails because the variables do not get passed to the script:
$ /usr/bin/run-one /usr/local/
status: testing $DEBUG...
+ rsync_opts=-v --progress -ah --stats --delete --numeric-ids
+ printf DEBUG != n, debug mode activated\n
DEBUG != n, debug mode activated
+ printf status: testing $TEST...\n
status: testing $TEST...
+ test y = n
+ rsync_opts=-n -v --progress -ah --stats --delete --numeric-ids
+ printf TEST != n, test mode activated\n
TEST != n, test mode activated
I tried playing around with xargs with no luck. For elegance, I'd rather not pass the variables to run-one itself, though this does work:
$ DEBUG=n TEST=n /usr/bin/run-one /usr/local/
status: testing $DEBUG...
DEBUG = n
status: testing $TEST...
TEST = n
Any ideas?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu run-one Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- toobuntu
- Solved:
- Last query:
- Last reply: