Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #167679

Re: Shell - escapes

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: Shell - escapes
Date 2016-05-10 16:20 +0200
Message-ID <rxgFZ-3QP-29@gated-at.bofh.it> (permalink)
References <rxeNQ-2bK-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

> I think it would be useful to have a (new, meta) quote, which fully hides
> contents from bash-interpretion

The '' quote does this. It's simply impossible that an end quotation mark
can be distinguished from a literal quotation mark.
If there would be escaping of literal string end marks, then you get even
more interpretation and conversion.

So the solution with two kinds of quotation marks is the most simple,
if you do not want to go to FORTRAN strings with length number and
Hollerith constant:  5Hhello

Unambiguous, ingenious, uncomfortable.


The best alternative i know of would be an adjustable end mark.
Before the string begins, one would adjust the environment to a character
or string which surely is not part of the literal text.

The Here Documents of the shell are an example of this design pattern.
Get some unlikely text:

  $ uuidgen
  2bf661c8-b400-43f3-addc-d2d75f018013

Announce and use it as delimiter:

  $ wc <<2bf661c8-b400-43f3-addc-d2d75f018013
  ... text ...
  2bf661c8-b400-43f3-addc-d2d75f018013

Regrettably, Here Documents let the shell fiddle with their text.

  $ wc -c <<x
  $(echo hello)
  x
  6

So this is not a way to express arbitrary literal text.


> Would it be useful / possible to change

One can switch from one shell to the other, one can even program an
own shell. But i see very few chance that bash or dash upstream would
accept any change or addition attempt about quoting. It is just too
fundamental and there are viable ways to express a literal string.


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shell - escapes Die Optimisten <inform@die-optimisten.net> - 2016-05-10 11:40 +0200
  bash Shell - escapes Die Optimisten <inform@die-optimisten.net> - 2016-05-10 11:40 +0200
    Re: bash Shell - escapes <tomas@tuxteam.de> - 2016-05-10 12:20 +0200
      Re: Shell - escapes "Thomas Schmitt" <scdbackup@gmx.net> - 2016-05-10 13:10 +0200
        Re: Shell - escapes <tomas@tuxteam.de> - 2016-05-10 13:30 +0200
  Re: Shell - escapes Mark Fletcher <mark27q1@gmail.com> - 2016-05-10 12:10 +0200
    Re: Shell - escapes "Thomas Schmitt" <scdbackup@gmx.net> - 2016-05-10 12:50 +0200
      Re: Shell - escapes Die Optimisten <inform@die-optimisten.net> - 2016-05-10 14:20 +0200
        Re: Shell - escapes <tomas@tuxteam.de> - 2016-05-10 14:30 +0200
          Re: Shell - escapes Mark Fletcher <mark27q1@gmail.com> - 2016-05-10 15:20 +0200
            Re: Shell - escapes David Wright <deblis@lionunicorn.co.uk> - 2016-05-10 16:00 +0200
            Re: Shell - escapes Mart van de Wege <mvdwege@gmail.com> - 2016-05-12 10:10 +0200
          Re: Shell - escapes tomas@tuxteam.de - 2016-05-10 15:30 +0200
        Re: Shell - escapes "Thomas Schmitt" <scdbackup@gmx.net> - 2016-05-10 16:20 +0200
          Re: Shell - escapes David Wright <deblis@lionunicorn.co.uk> - 2016-05-10 16:30 +0200
            Re: Shell - escapes "Thomas Schmitt" <scdbackup@gmx.net> - 2016-05-10 16:50 +0200
          Re: Shell - escapes <tomas@tuxteam.de> - 2016-05-10 16:40 +0200
  Re: Shell - escapes shawn wilson <ag4ve.us@gmail.com> - 2016-05-10 12:20 +0200
  Re: Shell - escapes Frédéric Marchal <frederic.marchal@wowtechnology.com> - 2016-05-10 12:30 +0200
  Re: Shell - escapes Andy Smith <andy@strugglers.net> - 2016-05-10 15:40 +0200
    Re: Shell - escapes <tomas@tuxteam.de> - 2016-05-10 16:00 +0200
    Re: Shell - escapes David Christensen <dpchrist@holgerdanske.com> - 2016-05-11 05:50 +0200

csiph-web