Useful CLI tools (bash) for Arch Linux administration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
514 B

6 years ago
  1. #!/bin/bash
  2. ###########################################################
  3. # Search a text pattern inside package files
  4. read -r -p "Enter search pattern: " TEXT
  5. if [[ -z $TEXT ]]; then
  6. echo -e "\nInvalid input\n"
  7. exit
  8. else
  9. for p in $(echo "${@}"); do
  10. echo -e " \033[1m\033[92m=>\033[39m\033[0m Files of package '$p' containing pattern '$TEXT':\n"
  11. for i in $(pacman -Ql $p | awk -F ' ' '{print $NF}' | sed '/\/*.*\/$/d'); do
  12. sudo grep -Ril "$TEXT" $i
  13. done
  14. done
  15. fi