fish: Expected a string, but found a redirection #9886
-
When I used bash I used to create files like this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Fish does not support running redirections without a command. This is an awkward special case in bash's grammar (actually the POSIX shell grammar) without any real need, and so it's not something fish does. Use One upside of not having this special case is that it allows you to find errors. E.g. if you accidentally do |
Beta Was this translation helpful? Give feedback.
Fish does not support running redirections without a command. This is an awkward special case in bash's grammar (actually the POSIX shell grammar) without any real need, and so it's not something fish does.
Use
touch filename
or: >filename
. The latter of which is what bash will do implicitly.One upside of not having this special case is that it allows you to find errors. E.g. if you accidentally do
foo & >file
instead offoo >file &
that will error out rather than runningfoo
with the wrong stdout.