Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/bashkit/src/builtins/awk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ fn normalize_awk_newlines(input: &str) -> String {
i += 1;
}
}
'\\' if i + 1 < chars.len() && chars[i + 1] == '\n' => {
// Backslash-newline: line continuation — join lines
i += 2;
}
'\n' if brace_depth > 0 => {
// Inside action block: replace newline with semicolon
result.push(';');
Expand Down
21 changes: 21 additions & 0 deletions crates/bashkit/tests/spec_cases/awk/awk.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -724,3 +724,24 @@ echo 'abc' | awk '/abc/ { print "yes" }'
### expect
yes
### end

### awk_backslash_newline_continuation
# Issue #836: backslash-newline line continuation
echo 'test' | awk '{
x = 1 + \
2
print x
}'
### expect
3
### end

### awk_backslash_newline_condition
# Issue #836: backslash-newline in condition
echo '5' | awk '{
if ($1 > 3 && \
$1 < 10) print "yes"
}'
### expect
yes
### end
Loading