Fix remaining two code-review findings, both verified live: 30-selfdiag.sh regex-metachar breakage (g++), fx.sh dedup collision on ] in candidate text

This commit is contained in:
2026-08-18 02:32:20 -04:00
parent d27d9a0819
commit 25ce1ca680
2 changed files with 21 additions and 4 deletions
+8 -2
View File
@@ -79,11 +79,17 @@ fx() {
out=$("$src" "$cmd" 2>/dev/null)
if [ -n "$out" ]; then
printf '%s\n' "$out" | while IFS= read -r line; do
[ -n "$line" ] && printf '[%s] %s\n' "$label" "$line"
[ -n "$line" ] && printf '%s\t%s\n' "$label" "$line"
done
[ -n "$FX_AUTO" ] && break
fi
done | awk -F'] ' '!seen[$2]++'
done | awk -F'\t' '
{
label = $1
text = substr($0, length(label) + 2)
if (!seen[text]++) print "[" label "] " text
}
'
)
chosen=""