Make literal "{}" expand to itself

This caused major annoyances with e.g. `find -exec`, and it's utterly
useless - "{}" expands to nothing, so why have it at all?

Fixes #1109.
This commit is contained in:
Fabian Homborg
2018-01-02 15:20:19 +01:00
parent 721df61f4b
commit 55ebf4430f
6 changed files with 27 additions and 16 deletions

View File

@@ -24,7 +24,6 @@
- <a href='#faq-titlebar'>I'm seeing weird output before each prompt when using screen. What's wrong?</a>
- <a href='#faq-greeting'>How do I change the greeting message?</a>
- <a href='#faq-history'>Why doesn't history substitution ("!$" etc.) work?</a>
- <a href='#faq-find-braces'>Why do I get a missing argument error with `find ... {}`?</a>
- <a href='#faq-cd-minus'>How can I use `-` as a shortcut for `cd -`?</a>
- <a href='#faq-uninstalling'>How do I uninstall fish?</a>
- <a href='#faq-third-party'>Where can I find extra tools for fish?</a>
@@ -244,21 +243,6 @@ Fish history recall is very simple yet effective:
See <a href='index.html#editor'>documentation</a> for more details about line editing in fish.
<hr>
\section faq-find-braces Why do I get a missing argument error with `find ... {}`?
Running `find ... -exec ... {}` produces an error:
find: missing argument to '-exec'
The problem is caused by the empty braces, which are subject to <a href="index.html#expand-brace">brace expansion</a>.
Quote the empty braces to achieve the desired effect:
\fish{cli-dark}
find ... -exec ... '{{}}'
\endfish
<hr>
\section faq-cd-minus How can I use `-` as a shortcut for `cd -`?

View File

@@ -506,6 +506,14 @@ mv *.{c,h} src/
# Moves all files with the suffix '.c' or '.h' to the subdirectory src.
\endfish
A literal "{}" will not be used as a brace expansion:
\fish
echo foo-{}
# Outputs foo-{}
echo foo-{$undefinedvar}
# Output is an empty line - see <a href="#cartesian-product">the cartesian product section</a>
\subsection expand-variable Variable expansion