From 0304135d2b97702c7455a2f8706e9c6a3712b25b Mon Sep 17 00:00:00 2001 From: Aurelio Jargas Date: Wed, 26 Aug 2020 18:29:03 +0200 Subject: [PATCH] docs: Use \ instead of \\ in examples (#7286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of informing the bell character (hex 07), the example was using an escaped \ followed by x07. $ echo \\x07 \x07 $ echo \x07 $ echo \x07 | od -a 0000000 bel nl 0000002 $ * docs: Use \u instead of \\u Instead of informing the Unicode character 慡, this example was using an escaped \ followed by u6161. $ echo \\u6161 \u6161 $ echo \u6161 慡 Before: $ string escape --style=var 'a1 b2'\\u6161 | string unescape --style=var a1 b2\u6161 Now: $ string escape --style=var 'a1 b2'\u6161 | string unescape --style=var a1 b2慡 --- doc_src/cmds/echo.rst | 2 +- doc_src/cmds/printf.rst | 2 +- doc_src/cmds/string-escape.rst | 8 ++++---- doc_src/cmds/string-match.rst | 2 +- doc_src/cmds/string-replace.rst | 6 +++--- doc_src/cmds/string-split.rst | 4 ++-- doc_src/cmds/string.rst | 2 +- doc_src/index.rst | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc_src/cmds/echo.rst b/doc_src/cmds/echo.rst index 373e1990f..b76d9db5c 100644 --- a/doc_src/cmds/echo.rst +++ b/doc_src/cmds/echo.rst @@ -64,7 +64,7 @@ Example > echo 'Hello World' Hello World - > echo -e 'Top\\nBottom' + > echo -e 'Top\nBottom' Top Bottom diff --git a/doc_src/cmds/printf.rst b/doc_src/cmds/printf.rst index 990970922..d42acf825 100644 --- a/doc_src/cmds/printf.rst +++ b/doc_src/cmds/printf.rst @@ -77,7 +77,7 @@ Example :: - printf '%s\\t%s\\n' flounder fish + printf '%s\t%s\n' flounder fish Will print "flounder fish" (separated with a tab character), followed by a newline character. This is useful for writing completions, as fish expects completion scripts to output the option followed by the description, separated with a tab character. diff --git a/doc_src/cmds/string-escape.rst b/doc_src/cmds/string-escape.rst index 4548d52da..9584e5309 100644 --- a/doc_src/cmds/string-escape.rst +++ b/doc_src/cmds/string-escape.rst @@ -37,11 +37,11 @@ Examples :: - >_ echo \\x07 | string escape - cg + >_ echo \x07 | string escape + \cg - >_ string escape --style=var 'a1 b2'\\u6161 - a1_20b2__c_E6_85_A1 + >_ string escape --style=var 'a1 b2'\u6161 + a1_20_b2_E6_85_A1_ .. END EXAMPLES diff --git a/doc_src/cmds/string-match.rst b/doc_src/cmds/string-match.rst index 455c8721a..9229b4ab2 100644 --- a/doc_src/cmds/string-match.rst +++ b/doc_src/cmds/string-match.rst @@ -52,7 +52,7 @@ Match Glob Examples >_ string match -i 'a??B' Axxb Axxb - >_ echo 'ok?' | string match '*\\?' + >_ echo 'ok?' | string match '*\?' ok? # Note that only the second STRING will match here. diff --git a/doc_src/cmds/string-replace.rst b/doc_src/cmds/string-replace.rst index 1564b03e4..b9396873d 100644 --- a/doc_src/cmds/string-replace.rst +++ b/doc_src/cmds/string-replace.rst @@ -53,13 +53,13 @@ Replace Regex Examples :: - >_ string replace -r -a '[^\\d.]+' ' ' '0 one two 3.14 four 5x' + >_ string replace -r -a '[^\d.]+' ' ' '0 one two 3.14 four 5x' 0 3.14 5 - >_ string replace -r '(\\w+)\\s+(\\w+)' '$2 $1 $$' 'left right' + >_ string replace -r '(\w+)\s+(\w+)' '$2 $1 $$' 'left right' right left $ - >_ string replace -r '\\s*newline\\s*' '\\n' 'put a newline here' + >_ string replace -r '\s*newline\s*' '\n' 'put a newline here' put a here diff --git a/doc_src/cmds/string-split.rst b/doc_src/cmds/string-split.rst index 857d9fed0..a43d9aa86 100644 --- a/doc_src/cmds/string-split.rst +++ b/doc_src/cmds/string-split.rst @@ -66,9 +66,9 @@ NUL Delimited Examples 42 >_ # Sort a list of elements which may contain newlines - >_ set foo beta alpha\\ngamma + >_ set foo beta alpha\ngamma >_ set foo (string join0 $foo | sort -z | string split0) >_ string escape $foo[1] - alpha\\ngamma + alpha\ngamma .. END EXAMPLES diff --git a/doc_src/cmds/string.rst b/doc_src/cmds/string.rst index 46209da57..ceea76f6b 100644 --- a/doc_src/cmds/string.rst +++ b/doc_src/cmds/string.rst @@ -314,4 +314,4 @@ In contrast to ``grep``, ``string``\ s `match` defaults to glob-mode, while `rep Like ``sed``\ s `s/` command, ``string replace`` still prints strings that don't match. ``sed``\ s `-n` in combination with a `/p` modifier or command is like ``string replace -f``. -``string split somedelimiter`` is a replacement for ``tr somedelimiter \\n``. +``string split somedelimiter`` is a replacement for ``tr somedelimiter \n``. diff --git a/doc_src/index.rst b/doc_src/index.rst index 0c2dbb740..95b2c7429 100644 --- a/doc_src/index.rst +++ b/doc_src/index.rst @@ -1293,7 +1293,7 @@ Variable Meaning ``fish_color_comment`` comments like '# important' ``fish_color_selection`` selected text in vi visual mode ``fish_color_operator`` parameter expansion operators like '*' and '~' -``fish_color_escape`` character escapes like '\\n' and '\\x70' +``fish_color_escape`` character escapes like '\n' and '\x70' ``fish_color_autosuggestion`` autosuggestions (the proposed rest of a command) ``fish_color_cwd`` the current working directory in the default prompt ``fish_color_user`` the username in the default prompt