Skip to content

Instantly share code, notes, and snippets.

@rustysys-dev
Created March 4, 2019 16:25

Revisions

  1. rustysys-dev created this gist Mar 4, 2019.
    14 changes: 14 additions & 0 deletions dnf-history-search.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function dnf-history-search () {
    if [ -z $1 ]; then
    echo -e "\nSpecify search term\n"
    return 0
    fi
    HISTORY=$(sudo dnf history | awk 'NR<=2 { next } { print $1 }')
    for item in $HISTORY
    do
    ITEM=$(sudo dnf history info $item | grep $1)
    if ! [ -z "$ITEM" ]; then
    echo -e "\n$item:\n\n$ITEM"
    fi
    done
    }