Skip to content

About touch * #9516

Closed Answered by faho
Nikaidou-Shinku asked this question in Q&A
Discussion options

You must be logged in to vote

It is, yes. See https://fishshell.com/docs/current/faq.html#my-command-prints-no-matches-for-wildcard-but-works-in-bash.

The short of it is this: In bash, the * is also considered to be a wildcard, except when it doesn't match bash just passes it on literally. In fish, if it doesn't match it errors out and doesn't run the command. This is like bash with the "failglob" option.

We consider the bash default behavior to be a mistake, and it requires some fairly awkward workarounds.

In your specific case, run:

rm '*'
touch foo

and now try touch * again in bash - it will no longer create a file called *, because now "foo" matches!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Nikaidou-Shinku
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants