DragonFly BSD
DragonFly commits List (threaded) for 2011-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: sh: Add $'quoting' (C-style escape sequences).


From: Peter Avalos <pavalos@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 21 Aug 2011 16:32:00 -0700 (PDT)

commit e1489450c38a053dad66768fc12706aa2968f646
Author: Peter Avalos <pavalos@dragonflybsd.org>
Date:   Sat Jul 2 14:29:49 2011 -1000

    sh: Add $'quoting' (C-style escape sequences).
    
    A string between $' and ' may contain backslash escape sequences similar
    to the ones in a C string constant (except that a single-quote must be
    escaped and a double-quote need not be). Details are in the sh(1) man
    page.
    
    This construct is useful to include unprintable characters, tabs and
    newlines in strings; while this can be done with a command substitution
    containing a printf command, that needs ugly workarounds if the result
    is to end with a newline as command substitution removes all trailing
    newlines.
    
    The construct may also be useful in future to describe unprintable
    characters without needing to write those characters themselves in 'set
    -x', 'export -p' and the like.
    
    The implementation attempts to comply to the proposal for the next issue
    of the POSIX specification. Because this construct is not in
    POSIX.1-2008, using it in scripts intended to be portable is unwise.
    
    Matching the minimal locale support in the rest of sh, the \u and \U
    sequences are currently not useful.
    
    Obtained-from:   FreeBSD SVN rev 221513

Summary of changes:
 bin/sh/mksyntax.c                              |    4 +-
 bin/sh/parser.c                                |  147 ++++++++++++++++++++++-
 bin/sh/sh.1                                    |   75 ++++++++++++-
 tools/regression/bin/sh/parser/dollar-quote1.0 |   12 ++
 tools/regression/bin/sh/parser/dollar-quote2.0 |    5 +
 tools/regression/bin/sh/parser/dollar-quote3.0 |   22 ++++
 tools/regression/bin/sh/parser/dollar-quote4.0 |   19 +++
 tools/regression/bin/sh/parser/dollar-quote5.0 |   12 ++
 tools/regression/bin/sh/parser/dollar-quote6.0 |    5 +
 tools/regression/bin/sh/parser/dollar-quote7.0 |    6 +
 tools/regression/bin/sh/parser/dollar-quote8.0 |   11 ++
 tools/regression/bin/sh/parser/dollar-quote9.0 |    8 ++
 12 files changed, 315 insertions(+), 11 deletions(-)
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote1.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote2.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote3.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote4.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote5.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote6.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote7.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote8.0
 create mode 100644 tools/regression/bin/sh/parser/dollar-quote9.0

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e1489450c38a053dad66768fc12706aa2968f646


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]