Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15550 > unrolled thread
| Started by | Patrick Blesi <patrick@ble.si> |
|---|---|
| First post | 2019-11-01 00:14 -0500 |
| Last post | 2019-11-01 00:14 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Feature Request: Custom delimeter for single quotes Patrick Blesi <patrick@ble.si> - 2019-11-01 00:14 -0500
| From | Patrick Blesi <patrick@ble.si> |
|---|---|
| Date | 2019-11-01 00:14 -0500 |
| Subject | Re: Feature Request: Custom delimeter for single quotes |
| Message-ID | <mailman.161.1572591097.13325.bug-bash@gnu.org> |
I just came across: Example 19-8 Here: http://tldp.org/LDP/abs/html/here-docs.html It looks like this example meets my needs. I'm curious why this method is referred to as devious though? -- Patrick On Thu, Oct 31, 2019 at 11:54 PM Patrick Blesi <patrick@ble.si> 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. > > Something akin to the following would alleviate the need to communicate > that users must escape single quotes, but also provide the same literal > string behavior of single quotes. > > presuming the arbitrarily substituted text is: > > echo 'this command is specified by the user' > > Then a syntax for this single quote heredoc behavior could be like: > > $ sh -c <<^MAGIC_WORD echo 'this command is specified by the user' > MAGIC_WORD > > Everything within the MAGIC_WORD declarations would not have command > substitution, variable expansion, etc, but would be treated as if it were > wrapped in single quotes with the exception that single quotes between the > MAGIC_WORDs need not be escaped. > > Pardon my naïveté, does any such feature exist or are there good ways to > accomplish this? If not, is this something that could feasibly be > implemented? Would it be desirable? > > Thanks, > > Patrick >
Back to top | Article view | gnu.bash.bug
csiph-web