SHARE
TWEET

Untitled

a guest Sep 16th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function egp(){
  2.  75     name="*"
  3.  76     extension="*"
  4.  77     pattern=""
  5.  78
  6.  79     while test $# -gt 0; do
  7.  80         case "$1" in
  8.  81             -h | --help)
  9.  82             echo "No arguments provided"
  10.  83             echo "egp <pattern> -ex/--extension <extensions> e.g.: .bb> -n/--name <filename>";;
  11.  84
  12.  85             -n | --name)
  13.  86             shift
  14.  87             if test $# -gt 0; then
  15.  88                 name=$1
  16.  89                 shift
  17.  90             else
  18.  91                 echo "Please provide argument"
  19.  92             fi
  20.  93             ;;
  21.  94
  22.  95             -ex | --extension)
  23.  96             shift
  24.  97             if test $# -gt 0; then
  25.  98                 extension=$1
  26.  99                 shift
  27. 100             else
  28. 101                 echo "Please provide argument"
  29. 102             fi
  30. 103             ;;
  31. 104
  32. 105             *)
  33. 106             pattern=$1
  34. 107             break;
  35. 108             ;;
  36. 109         esac
  37. 110     done
  38. 111
  39. 112     if [ "$pattern" != "" ]; then
  40. 113         efind "${name}.${extension}" | xargs -I % grep -IHnsi "${pattern}" %
  41. 114         #echo "efind "${name}.${extension}" | xargs -I % grep -IHnsi "${pattern}" %"
  42. 115     else
  43. 116         echo "Please provide pattern"
  44. 117     fi
  45. 118 }
  46. 119
  47. 120 function efind(){
  48. 121     find . \( -not \( -path ./5g-jabco-w5-x11 -prune \) -not \( -path ./5g-jabco-w5-x12 -prune \)  -not \( -path ./5g-poco-mk4-hf -prune \) -not \( -path ./.repo -prune \) -not \( -path ./.git -prune \) \) -name "*"${1}"*"
  49. 122 }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top