Advertisement
FranzVuttke

search_in_pacman_log

Nov 17th, 2023 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | Source Code | 0 0
  1. #!/bin/bash
  2. # search_in_pacman_log
  3.  
  4. #
  5. # by OuNiS 11.2023
  6. #
  7. # $@ - wszystkie parametry wej.
  8. # $# - liczba parametrów wej.
  9.  
  10. # https://stackoverflow.com/questions/7989486/check-that-there-are-at-least-two-arguments-given-in-a-bash-script
  11. # sprawdzanie liczby parametrów
  12. PACMAN_LOG_DEST=/var/log/pacman.log
  13. echo Przeglądanie w pliku: $PACMAN_LOG_DEST
  14.  
  15. if test -e $PACMAN_LOG_DEST ; then
  16.     if [ $# -gt 0 ]
  17.     then
  18.         grep "$1" "$PACMAN_LOG_DEST"
  19.     else
  20.         echo ERR: Brak parametru!!!
  21.     #     echo Jedziemy!!!
  22.     fi
  23. else
  24.    echo "BŁĄD: Plik '$PACMAN_LOG_DEST' nie istnieje"\!\!\!
  25. fi
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement