mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 22:14:49 +08:00
docs: Use \ instead of \\ in examples (#7286)
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慡
This commit is contained in:
parent
10aa91250d
commit
0304135d2b
|
@ -64,7 +64,7 @@ Example
|
|||
> echo 'Hello World'
|
||||
Hello World
|
||||
|
||||
> echo -e 'Top\\nBottom'
|
||||
> echo -e 'Top\nBottom'
|
||||
Top
|
||||
Bottom
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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``.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user