Skip to content

Commit 71f2232

Browse files
committed
Perform cr/lf handling first
1 parent 188cd43 commit 71f2232

File tree

1 file changed

+6
-7
lines changed
  • apache-maven/src/assembly/maven/bin

1 file changed

+6
-7
lines changed

apache-maven/src/assembly/maven/bin/mvn

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,12 @@ find_file_argument_basedir() {
168168
# concatenates all lines of a file and replaces variables
169169
concat_lines() {
170170
if [ -f "$1" ]; then
171-
# First replace variables in the content
172-
while IFS= read -r line || [ -n "$line" ]; do
173-
# Replace both ${MAVEN_PROJECTBASEDIR} and $MAVEN_PROJECTBASEDIR with actual value
174-
line=${line//\$\{MAVEN_PROJECTBASEDIR\}/$MAVEN_PROJECTBASEDIR}
175-
line=${line//\$MAVEN_PROJECTBASEDIR/$MAVEN_PROJECTBASEDIR}
176-
echo "$line"
177-
done < "$1" | tr -s '\r\n' ' '
171+
# First transform line endings to spaces
172+
content=`tr -s '\r\n' ' ' < "$1"`
173+
# Then do variable substitution on the single line
174+
content=${content//\$\{MAVEN_PROJECTBASEDIR\}/$MAVEN_PROJECTBASEDIR}
175+
content=${content//\$MAVEN_PROJECTBASEDIR/$MAVEN_PROJECTBASEDIR}
176+
echo "$content"
178177
fi
179178
}
180179

0 commit comments

Comments
 (0)