Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm writing tcsh scripts and I would like to append to a log file, but if the log file doesn't exist before appending to it, I get an error (reproduced below). In bash the file gets created if it doesn't already exist. Does tcsh support this feature or do I have to ensure that the file exists before appending to it?

Is there a way to use the >> operator in tcsh similar to bash?

$ echo something >> file_that_does_not_exist
file_that_does_not_exist: No such file or directory.
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Try

command >>! log_file_name

Or this for redirecting stderr as well

command >>&! log_file_name

See csh(1) and/or tcsh(1), here and here, for example.

share|improve this answer

Your Answer

 
discard

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.