'!!' 설치 방법 명령?

'!!' 설치 방법 명령?

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

$ 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
~$ 

관련 정보