How to write scripts that can run in bash and csh?

Posted by Victor Liu on Stack Overflow See other posts from Stack Overflow or by Victor Liu
Published on 2010-04-13T18:56:40Z Indexed on 2010/04/13 23:43 UTC
Read the original article Hit count: 377

Filed under:
|
|

I'm not sure if this is even possible, but is there a way to write shell scripts that can be interpreted by both the Bourne shell as well as C shell? I want to avoid simply checking for the shell and running a shell-specific code. If this is possible, are there any guides on how to do it?

I have always written my scripts for Bourne shell syntax, and I know next to nothing about csh, so this may be a stupid question. I have Google'd for the differences between shells, but there is little information (as far as I can tell) on its implications for scripting.

© Stack Overflow or respective owner

Related posts about scripting

Related posts about shell