From 383b243ebdff98b4ccef3947e771b2fee2b00466 Mon Sep 17 00:00:00 2001 From: cubernetes Date: Fri, 23 Oct 2026 17:39:46 +0200 Subject: [PATCH] Improve quine printf --- bashrc-forward.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bashrc-forward.sh b/bashrc-forward.sh index 4f2ff8d..c0b8103 100644 --- a/bashrc-forward.sh +++ b/bashrc-forward.sh @@ -94,18 +94,14 @@ bashrc_forward () { [[ "${ENV##*/}" =~ ^[0-9]+$ ]] && builtin eval "builtin exec ${ENV##*/}<&-" #-# Constructs new ENV after every command, thanks to the quine - builtin exec {ENV}< <( - printf %s "${_s@A} - $_s" - ) + builtin exec {ENV}< <(printf "%s\\n%s" "${_s@A}" "$_s") export ENV="/dev/fd/$ENV" '\''\'\'''\''\'\''\'\'''\'''\''\'\'''\'' '\''\'\'''\'' - printf %s "${_s@A} - $_s" + printf "%s\\n%s" "${_s@A}" "$_s" #-# Suppress the warning `bash: POSIXLY_CORRECT: readonly variable` using a one-shot DEBUG trap #-# `PS0` and `PROMPT_COMMAND` will not suffice, `PROMPT_COMMAND` runs AFTER the command, therefore