fish-shell/doc_src
Fabian Boehm 20243132fb Add <? input redirection
This tries to open the given file to use as stdin, and if it fails,
for any reason, it uses /dev/null instead.

This is useful in cases where we would otherwise do either of these:

```fish
test -r /path/to/file
and string match foo < /path/to/file

cat /path/to/file 2>/dev/null | string match foo
```

This both makes it nicer and shorter, *and* helps with TOCTTOU - what if the file is removed/changed after the check?

The reason for reading /dev/null instead of a closed fd is that a closed fd will often cause an error.

In case opening /dev/null fails, it still skips the command.
That's really a last resort for when the operating system
has turned out to be a platypus and not a unix.

Fixes #4865

(cherry picked from commit df8b9b7095)
2024-04-21 14:35:13 +02:00
..
cmds Deprecate builtin test's one- and zero-argument modes (#10365) 2024-04-21 14:25:54 +02:00
python_docs_theme docs: use canonical key names in :kbd: tags 2024-04-20 15:36:29 +02:00
commands.rst docs: Add fish_should_add_to_history to commands list 2024-03-09 12:09:00 +01:00
completions.rst Fix grammar in completion docs 2023-07-09 14:11:01 +08:00
conf.py Enable Sphinx man_show_urls config 2024-04-20 13:34:08 +02:00
contributing.rst Improve CONTRIBUTING and add it to the docs 2023-06-01 18:09:02 +02:00
design.rst docs: Fix typos 2022-09-17 21:31:06 +08:00
faq.rst docs: use canonical key names in :kbd: tags 2024-04-20 15:36:29 +02:00
fish_for_bash_users.rst docs: Explain globs more in fish-for-bash-users 2024-01-14 11:06:51 +01:00
fish_indent_lexer.py docs: restore default highlighting keywords and options in HTML 2022-01-16 14:07:19 +01:00
fish_synopsis.py Document the ! (not) and . (source) aliases more 2024-04-20 13:34:08 +02:00
index.rst docs: Some slight rewordings 2023-08-23 23:08:56 +02:00
interactive.rst docs: More on new keys 2024-04-20 17:05:46 +02:00
language.rst Add <? input redirection 2024-04-21 14:35:13 +02:00
license.rst Import FindRust from Corrosion 2024-01-30 18:18:55 +08:00
prompt.rst docs/prompt: A few small fixes 2024-02-03 11:12:11 +01:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: use canonical key names in :kbd: tags 2024-04-20 15:36:29 +02:00