Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$(...) calls should be quoted: "$(...)" #1667

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vandenoever
Copy link

vim $(fzf) will not open files that have a space in the name. To fix that, use double quotes.

`vim $(fzf)` will not open files that have a space in the name. To fix that, use double quotes.
@@ -89,7 +89,7 @@ to install fzf.
brew install fzf

# To install useful key bindings and fuzzy completion:
$(brew --prefix)/opt/fzf/install
"$(brew --prefix)/opt/fzf/install"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this one 🤔

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The brew prefix path might include spaces, so strictly speaking it must be quoted (no one ever uses a non-default brew prefix, so yeah..)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@junegunn junegunn added the doc label Mar 11, 2020
@vandenoever
Copy link
Author

Looks good

@junegunn
Copy link
Owner

junegunn commented Apr 1, 2020

I assumed that most of the users already know the implication of omitting quotes – files paths with spaces are quite rare on Unix systems, so we casually omit quotes when typing commands, and put them only when they are necessary. The commands on the README page are just simple examples (except for brew one), so I decided to omit quotes to have less visual clutter. But I don't have a strong opinion on how we should present them.

@vandenoever
Copy link
Author

On my system they are not rare. I do not think I'm an exception.

$ find ~ -name '* *' | wc -l
13637

Since omitting quotes can lead to bugs, it's always good to quote. shellcheck is a handy tool to remind of that.

@LuRsT
Copy link

LuRsT commented Apr 1, 2020

How about a happy medium, where we consistently don't use quotes, but have a note somewhere stating that using quotes is necessary for files with spaces?

@junegunn junegunn mentioned this pull request Jul 20, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants