Я использовал команду
set -r noclobber
Теперь я не могу сбросить. cat >1.txt
шоу Restricted: can't redirect output
Это, кажется, не перечислено под set
встроенный, но set -r
кажется, имеет тот же эффект как вызов bash
с -r
параметр командной строки: то есть, как зарегистрировано под OPTIONS
-r If the -r option is present, the shell becomes restricted (see RESTRICTED SHELL below).
Под RESTRICTED SHELL
Вы будете видеть
RESTRICTED SHELL If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the following are disallowed or not performed:
Одно из ограничений
· redirecting output using the >, >|, <>, >&, &>, and >> redirect‐ ion operators
который объясняет, почему Вы видите Restricted: can't redirect output
.
Обычно, когда опция установлена с set -
, это может быть выключено с эквивалентом set +
. Однако, поскольку Вы могли бы ожидать, одна из вещей, ограниченных RESTRICTED SHELL
режим
· turning off restricted mode with set +r or set +o restricted.
Так, насколько я знаю, что Ваша единственная опция будет состоять в том, чтобы запустить новую, неограниченную оболочку.
set -o noclobber
опция (или эквивалентно set -C
) также перенаправление влияния, но в отличие от этого -r
только, когда конечный файл существует:
-C If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators. This may be overridden when creating output files by using the redi‐ rection operator >| instead of >.
Также, в отличие от этого, -r
, это - toggleable использование set +C
(или set +o noclobber
).