Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.37 KB | None | 0 0
  1. #!/bin/bash --posix
  2.  
  3. #if [ $# = 0 ]; then
  4. #   tmp=fatal not enough arguments         
  5. #fi
  6.  
  7. contains() {
  8.     string="$1"
  9.     substring="$2"
  10.     if test "${string#*$substring}" != "$string"
  11.     then
  12.         return 0    # $substring is in $string
  13.     else
  14.     return 1    # $substring is not in $string
  15.     fi
  16. }
  17.  
  18. posixUtilities="admin alias ar asa at awk basename batch bc bg c99 cal cat cd cflow chgrp chmod chown cksum cmp comm command compress cp crontab csplit ctags cut cxref date dd delta df diff dirname du echo ed env ex expand expr false fc fg file find fold fort77 fuser gencat get getconf getopts grep hash head iconv id ipcrm ipcs jobs join kill lex link ln locale localedef logger logname lp ls m4 mailx make man mesg mkdir mkfifo more mv newgrp nice nl nm nohup od paste patch pathchk pax pr printf prs ps pwd qalter qdel qhold qmove qmsg qrerun qrls qselect qsig qstat qsub read renice rm rmdel rmdir sact sccs sed sh sleep sort split strings strip stty tabs tail talk tee test time touch tput tr true tsort tty type ulimit umask unalias uname uncompress unexpand unget uniq unlink uucp uudecode uuencode uustat uux wait val wc what who vi write xargs yacc zcat"
  19.  
  20. whereis $posixUtilities > tmp.txt
  21.  
  22. found=0
  23. notFound=0
  24.  
  25. cat tmp.txt | while read line
  26. do
  27.     if [ contains "/" $line = 0]
  28.     then
  29.         found=$found+1;
  30.     else
  31.         echo $line
  32.         notFound=$notFound+1;
  33.     fi
  34. done
  35.  
  36. echo $found $notFound
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement