Skip to content

Commit 81cbad5

Browse files
Beauuu-0826claude
andcommitted
[BugFix] Read the last conf line when the file has no trailing newline
`while read line` returns a non-zero status on EOF, so when a conf file does not end with a newline the final line is read into `$line` but the loop body never runs and that variable is silently dropped. Keep looping while `$line` is still non-empty so the last line is exported as well. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: eason <1569163626@qq.com>
1 parent 6b20161 commit 81cbad5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bin/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ read_var_from_conf() {
6565
}
6666

6767
export_env_from_conf() {
68-
while read line; do
68+
while read line || [[ -n "$line" ]]; do
6969
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | grep -E "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
7070
envline=`eval "echo $envline"`
7171
if [[ $envline == *"="* ]]; then

0 commit comments

Comments
 (0)