WebFaction
Community site: login faq

I'm trying to setup development and production environments with shell scripts to deploy from one environment to the next, but I can't figure out the proper format for the shell script. Admittedly I don't have a lot of experience with with Linux shell scripts, though I understand the structure and have extensive Batch experience. Usually they begin with #!/bin/bash but when I use that I get:

-bash: ./bin/deploy-stage.sh: /bin/bash^M: bad interpreter: No such file or directory

I did check and /bin/bash does exist, I assume users just don't have access to it. When I don't include #!/bin/bash, the first (and at the moment the only) line, that consists of a simple cd command, gives me the error:

: No such file or directory 5: cd: /home/[me]/webapps/[my_app]/

I copied and pasted the command to a terminal window and it worked just fine.

Is there a way to do what I'm trying to do?

asked 18 Jun '11, 20:48

Rupe
411814
accept rate: 0%


/bin/bash is the correct path. The problem here appears to be the ^M character in the error message:

/bin/bash^M: bad interpreter

This suggests that your script has DOS line-endings. Try using the command dos2unix on your script to convert it to unix format. Hope that helps!

permanent link

answered 18 Jun '11, 20:52

ryans ♦♦
5.0k93160
accept rate: 43%

Thank you, I saved it as a Unix file format in my text editor and it worked just fine.

(18 Jun '11, 20:55) Rupe
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×23
×16

question asked: 18 Jun '11, 20:48

question was seen: 3,237 times

last updated: 18 Jun '11, 20:55

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM