Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: Re: Feature Request: Custom delimeter for single quotes Date: Sat, 02 Nov 2019 23:08:57 -0700 Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: <5DBE6EF9.2000309@tlinx.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1572761403 24473 209.51.188.17 (3 Nov 2019 06:10:03 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Patrick Blesi Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5DBE6EF9.2000309@tlinx.org> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:15560 On 2019/10/31 21:54, Patrick Blesi wrote: > I'm looking for a hybrid between single quotes and a here doc or here > string. > > The main use case is for accepting arbitrary user-specified text. I would > like to wrap this text in single quotes so as to prevent any variable > expansion or interpretation of the text of any kind. Additionally, I would > like to allow the users to include single quotes in their text without > requiring that they escape these quotes. > I can't say for certain, but is there any reason why this wouldn't work? As long as the user input doesn't match the generated uuid, it should be hard to match it as a delimiter... I am probably missing something obvious, but this would seem to solve your problem, no? read usercmd # or whatever/however you get the command delim=$(uuidgen) printf -v cmd "sh -c <<'%s'\n%s\n%s\n" "$delim" "$usercmd" "$delim" eval $cmd