Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I'm writing a few daemons implemented in pure shell script and would like to use zsh(powerful substitutions, modules with socket/tcp handling, etc) instead of the default /bin/sh. Can I tell the 'script' stanza to use a custom shell?

share|improve this question
up vote 2 down vote accepted

There is no [documented] way to switch from /bin/sh as the main shell script run in. However, you could just wrap your script up in zsh. I do this with bash in various places (usually find's -exec clause):

zsh -c "do things...; more things..."

A slightly more elegant way would be:

zsh -- <<EOF

# do stuff here

end script
share|improve this answer
Simple but works nicely. It would be better if upstart provided a native way to use a custom shell, so editors like vim wouldn't loose syntax highlighting/indentation in the heredoc. – Thiago de Arruda Apr 6 '13 at 1:32

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.