Read last line of config files without EOL

The last line in a configuration file may not have a terminating EOL character. This commit fixes the launcher script to read that line as well.

Inspiration: https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
This commit is contained in:
Iulian Dragos 2017-06-30 16:31:28 +02:00 committed by GitHub
parent ace1846e36
commit a616031ca3
1 changed files with 2 additions and 1 deletions

View File

@ -135,7 +135,8 @@ process_my_args () {
} }
loadConfigFile() { loadConfigFile() {
cat "$1" | sed '/^\#/d' | while read line; do # Make sure the last line is read even if it doesn't have a terminating \n
cat "$1" | sed '/^\#/d' | while read -r line || [[ -n "$line" ]]; do
eval echo $line eval echo $line
done done
} }