Как установить '!!' команда?

Я пытался использовать !! при моей новой установке debian, и я получаю следующую ошибку:

$ sudo !!
sudo: !!: command not found

Я действительно использую !! ?

Также как я могу позвонить !! , чтобы я мог найти в Google что-нибудь об этом?

-2
13.10.2016, 22:19
1 ответ

Вы ссылаетесь на функцию history своей оболочки, когда обращаетесь к !!

Я не уверен, какую оболочку вы используете. Из man bash :

HISTORY EXPANSION
   The  shell  supports a history expansion feature that is similar to the
   history expansion in csh.
...
Event Designators
   An  event designator is a reference to a command line entry in the his‐
   tory list.  Unless the reference is absolute, events  are  relative  to
   the current position in the history list.

   !      Start  a  history substitution, except when followed by a blank,
          newline, carriage return, = or ( (when the extglob shell  option
          is enabled using the shopt builtin).
   !n     Refer to command line n.
   !-n    Refer to the current command minus n.
   !!     Refer to the previous command.  This is a synonym for `!-1'.

Есть ли что-нибудь в истории вашей оболочки? Когда вы вводите команду history , получаете ли вы какой-либо результат?

Я не могу воспроизвести ошибку, которую вы видите:

~$ ls -l | head -1
total 54324
~$ sudo !!
sudo ls -l | head -1
total 54324
~$ 
5
28.01.2020, 05:14

Теги

Похожие вопросы