0

I have made a script that buld runs and installs SteamCMD server but I noticed very weird problem that is stoping me in further development. My code:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker pull yzere/steamcmd:latest
docker run -it -d --name=steamcmd yzere/steamcmd bash
docker exec -it steamcmd bash
/bin/bash ./steamcmd.sh +login anonymous +app_update 343050 +quit
curl -o ~/run_dedicated_server.sh https://github.com/yzere/steamcmd/blob/master/run_dedicated_server.sh
chmod u+x ~/run_dedicated_server.sh
mkdir ~/.klei/
mkdir ~/.klei/DoNotStarveTogether/
echo "Now upload MyDediServer.zip and unpack in .klei/DoNotStarveTogether/, after this again run ~/run_dedicated_server.sh"

and beside problem with docker instalation, after i run ls on my machine there was this folder: image

with the name of '.klei'$'\r' instead of intended .klei It also makes terminal go crazy when i tried to enter this directory. I really look for some kind of explaination or solution to this.

Also error message when i run this script was this

E: Invalid operation update
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io
   '
E: Couldn't find any package by regex 'containerd.io
   '
./server.sh: line 3: docker: command not found
./server.sh: line 4: docker: command not found
./server.sh: line 5: docker: command not found
/bin/bash: ./steamcmd.sh: No such file or directory
curl: (3) URL using bad/illegal format or missing URL
chmod: cannot access '/home/yzere12/run_dedicated_server.sh'$'\r': No such file or directory
mkdir: cannot create directory ‘/home/yzere12/.klei\r’: File exists
mkdir: cannot create directory ‘/home/yzere12/.klei/DoNotStarveTogether\r’: No such file or directory
Now upload MyDediServer.zip and unpack in .klei/DoNotStarveTogether/, after this again run ~/run_dedicated_server.sh

I run linux wersion of Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64

yzere
  • 1
  • What is the question? Do you want to rename the directory? – Cyrus Jun 28 '20 at 17:29
  • 4
    how did you create the script? did you type/edit manually? did you copy from another machine (perhaps Windows to Linux; `\r` references from Windows/DOS?) and if so what command(s) did you use to copy? the slew of error messages (ie, all of your commands are generating errors) would seem to indicate something wrong with the script (eg, embedded non-printing/control characters); you may want to review the contents of the script (eg, `od -c your_script_name`) for any unwanted/non-printing characters; alternatively, manually create the script from scratch using a based editor (eg, vim) – markp-fuso Jun 28 '20 at 17:51
  • 1
    also, error mentions `containerd.io...` with what appears to be an embedded carriage return or linefeed in the name of the package, which seems to jive with the multiple references to `\r`; so ... I'm thinking your script file is corrupted and needs to be edited or recreated from scratch – markp-fuso Jun 28 '20 at 17:57
  • See ["Are shell scripts sensitive to encoding and line endings?"](https://stackoverflow.com/questions/39527571/are-shell-scripts-sensitive-to-encoding-and-line-endings) (especially the "Solutions" section of the top answer). – Gordon Davisson Jun 28 '20 at 18:19

0 Answers0