Advertisement
andrejsstepanovs

/usr/bin/findindir

Oct 19th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.26 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. GREP="/usr/bin/grep"
  4. XARG="/usr/bin/xargs"
  5. PATH=$1
  6. EXT=$2
  7.  
  8. CMD="$GREP -l -r --include=\*.$EXT $3 $PATH"
  9.  
  10. for VAR in "${@:3}"
  11. do
  12.     if [ -n "$VAR" ]; then
  13.         CMD="$CMD | $XARG $GREP -l $VAR"
  14.     fi
  15. done
  16.  
  17. /bin/bash -c "$CMD"
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement