Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function count (){
  4.         F=$1
  5.         echo "Includes in $F: "
  6.         printf "\n\n"
  7.         includes=$(cat $F | sed "s/ //g" | grep -o "#include<.*>")
  8.         IFS=$"\n"
  9.         for include in $includes; do
  10.                 printf "%s" $include
  11.         done
  12.         IFS=$" "
  13.         printf "\n\n"
  14.         return 0;
  15. }
  16.  
  17. while [ $1 ]; do
  18.    if [ -d $1 ]; then
  19.         for F in $(find $1 -type f);do
  20.                 name=$(basename $F)
  21.                 if echo $name | grep -q "^.*\.[ch]$"; then
  22.                         count $F
  23.                 fi
  24.         done
  25.    else
  26.         echo "$1 is not a directory!"
  27.    fi
  28.    shift
  29. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement