The first thing I would be looking at is your script itself, by doing something like:
od -xcb deploy_app.sh
and looking for any carriage return characters (CR, ^M
, \r
, hex 0d
, or octal 015
) at the end of the cd
line (or any line really).
That's because, if you have CR characters at the end, it will cause that problem (the ^M
characters below were entered with CTRL-VCTRL-M):
pax:~> cd blah^M^M^M^M
-bash: cd: $'blah\r\r\r\r': No such file or directory
If there are CR characters in your file, you probably want to remove them, and check your line ending settings for git
(assuming that file is in a repo) - this is a problem commonly caused by incorrect settings if you're updating your repo from both Windows and Unix.
If that file is not being "damaged" by git
, you'll need to discover what else is putting those characters in.
And, as an aside, you wouldn't actually see whether the reponame
had those characters with an echo
, since echoing them would result in the actual characters, four "go to the start of the line" characters, then a "go to the next line" character. Hence there's no way to tell the difference just by looking, without pushing the output through a command like od
.