Bash-Suche und vorheriges Kommando ausführen

Bash-Suche und vorheriges Kommando ausführen

EntsprechendO'Reilys Bash Pocket-Referenz (Seite 40)Im Folgenden wird der neueste Befehl ausgeführt, der Folgendes enthält string:

!?string[?]

Ich führe den besagten Befehl aus, erhalte aber immer die Antwort:

bash: !?string[?: event not found

Wie kann ich das machen?

Antwort1

Aus dem Bash-Handbuch:

!?string[?]
     Refer to the most recent command preceding the current position
     in the history list containing string.  The trailing ? may be
     omitted if string is followed immediately by a newline.

Das [?]bedeutet, dass das Anhängen ?optional ist. Sie finden diese Konvention in den meisten Übersichtsabschnitten der Online-Handbücher, zum Beispiel

NAME
     ls – list directory contents

SYNOPSIS
     ls [-1AaCcdFfgHhikLlmnopqRrSsTtux] [file ...]

verwandte Informationen