"!!" 명령을 설치하는 방법은 무엇입니까?

"!!" 명령을 설치하는 방법은 무엇입니까?

!!새로 설치된 데비안에서 사용 하려고 하는데 다음 오류가 발생합니다:

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

이점을 누릴 수 있나요 !!?

또한 !!실제로 이에 대한 정보를 Google에서 검색할 수 있도록 무엇을 호출할 수 있나요?

답변1

당신은 인용하고 있습니다역사인용할 때 쉘이 수행하는 작업!!

어떤 쉘을 사용하고 있는지 잘 모르겠습니다. 에서 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
~$ 

관련 정보