「!!」コマンドをインストールする方法は?

「!!」コマンドをインストールする方法は?

!!新しくインストールされた Debian で使用しようとすると、次のエラーが発生します。

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

おすすめ記事