-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add ash-specific patterns for line continuation in stage_q4
Co-Authored-By: Paul Kuruvilla <[email protected]>
- Loading branch information
1 parent
998d2f9
commit 16a02ef
Showing
2 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
#!/bin/sh | ||
exec ash | ||
exec ash -c ' | ||
while true; do | ||
printf "[your-program] $ " | ||
read -r cmd | ||
if [ -z "$cmd" ]; then | ||
continue | ||
fi | ||
if [ "$cmd" = "exit" ] || [ "$cmd" = "exit 0" ]; then | ||
exit 0 | ||
fi | ||
# Handle line continuation in single quotes by escaping backslashes | ||
if echo "$cmd" | grep -q "echo.*'\''.*\\\\\\\\n.*'\''"; then | ||
# Double the backslashes to prevent line continuation | ||
modified_cmd=$(echo "$cmd" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g") | ||
eval "$modified_cmd" | ||
else | ||
eval "$cmd" | ||
fi | ||
done | ||
' |