I'm trying to upload and download a bash script from pastebin, upload was straightforward enough with copy and paste, download didn't go as easy.
There are two scripts I'm trying to download, these are the commands:
wget http://pastebin.com/raw.php?i=M6iQ6RaY --output-document=ts3update
wget http://pastebin.com/raw/e11R2wkP --output-document=ts3restore
When I try to run them, I get this error:
./ts3update: /bin/bash^M: bad interpreter: No such file or directory
Then if I remove the interpreter line, I just get this:
./ts3update: line 4: $'\r': command not found
And this:
./ts3restore: line 3: $'\r': command not found
./ts3restore: line 7: syntax error near unexpected token `$'in\r''
'/ts3restore: line 7: ` case $yn in
Why does this happen, and how can I fix it? When I read or grep the files I find no instances of ^M or '\r' why does bash see something like that when nothing else does?
dos2unix ts3restore
. – Michael Homer Mar 02 '16 at 03:46/bin/bash^M
does not exist, so can not be used as an interpreter to run the script. The solution is also the same - convert to unix style LF-only line-endings. – cas Mar 02 '16 at 04:39