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

Can someone tell me how to to run a php script and output content and errors to a text file (using nohup) using csh?

share|improve this question

If your script has a hash-bang line (such as #!/bin/env php) at the top, you can run it directly like this:

nohup /path/to/your_script.php > /path/to/output.txt 2>&1 &

If not you can call the parser first with your script as an argument:

nohup php /path/to/your_script.php > /path/to/output.txt 2>&1 &

You didn't specifically mention you wanted to background the job, but usually when you nohup something you also want to background it, so I added the trailing & to the suggestions above.

share|improve this answer
thanks - it doesn't work though i get "ambigous output redirect"? – jimsmith Jun 10 '11 at 15:25
Can you tell us what echo $SHELL tells you as well as the full command you are executing? – Caleb Jun 10 '11 at 15:27
/bin/csh the full command is exactly as you have it – jimsmith Jun 10 '11 at 15:29
Your question states you are using bash, but that is csh! I don't know enough about csh to give you an equivalent. Perhaps you should edit your question with that detail. Also it's not reasonable that the full command would be just as I have it because I have dummy paths. Seeing a full copy-paste from your terminal might helps us catch other mistakes. – Caleb Jun 10 '11 at 15:31
Perhaps you should switch to bash or zsh? If you don't have specific reasons for using csh it might be easier for you to learn standard syntax that a majority of Linux folks use. – Caleb Jun 10 '11 at 15:33

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.