shell reads file created in windows incorrectly

后端 未结 2 823
借酒劲吻你
借酒劲吻你 2021-01-14 12:47

Here is my shell script and properties file

test.sh

#!/bin/bash
source ./default.properties
echo $app_name
echo \"$app_name ==\"

de

2条回答
  •  没有蜡笔的小新
    2021-01-14 13:06

    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
    

提交回复
热议问题