Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In an init.d file i wrote the below. Now i need to make the bin run in a specific directory. How do i tell it which directory to use?

mono --debug /path/bin &
share|improve this question
up vote 5 down vote accepted
cd /my/directory
mono --debug /path/bin &
share|improve this answer
"cd /my/directory && mono --debug /path/bin &" would be better. – symcbean Oct 5 '11 at 12:01
@symcbean that's true, if you're worried the directory might not exist, your way is better. – Paul Tomblin Oct 5 '11 at 13:27
try this without changing the current directory of the shell /bin/env PWD=/my/directory /path/to/mono --debug /path/bin & – Nikhil Mulley Dec 5 '11 at 16:56
@PaulTomblin I would suggest to use the full path to mono, to avoid any ambiguity from any possible mono program/script being present in /my/directory and if the PATH leads to use the current working directory as the source for first lookup. – Nikhil Mulley Dec 5 '11 at 16:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.