Linux error “invalid unit name escaped as” when running through shell script.

In most cases the problem is due to the editor you used for creating the shell script. If that is the case, in the error message you can see your service unit name is appended with something like “x0d”. To fix it quick, for example in notepad++, go to Edit and change the EOL Conversion to Unix (LF). If you use other editor then find out the similar option.

Another way to fix this is open your shell script in Linux Nano editor or other linux native editor and just remove the last letter “e” then retype and save.

Updated : 12 May 24

Knowledge Bites

Scroll to Top