Here is my shell script and properties file
test.sh
#!/bin/bash
source ./default.properties
echo $app_name
echo \"$app_name ==\"
de
As tripleee already mentioned it is a problem with the different encoding in windows and linux. You could also encounter problems with special chars like "äöüß"
You can use the linux tool "recode".
Example: change encoding from ibmpc (DOS with cr-lf to latin)
recode ibmpc..lat1 test.sh
See all supported charsets:
recode --list
Yes, you have a DOS carriage return at the end of the line which assigns the appName
variable. This control character causes the cursor to move back to the beginning of the line in most terminals.
Good catch; most askers here don't even realize this is a problem. The bash tag wiki has a section about troubleshooting this issue.
Many tools on Unix will show the problematic character as ^M
(control-M) or its octal code \015
; in hex it's character code 0x0D and in decimal it's 13.
In the future, if you absolutely have to use a Windows editor, save with Unix line endings, transfer the file using ftp
ASCII mode (not a popular or safe option these days), or run dos2unix
on the file on Unix after transferring it.