daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. ### Afiseaza un arbore cu structura directorului curent de lucru al utilizatorului, sau al altui director specificat ca argument  ###
  3.  
  4. count=0
  5. nrDir=0
  6.  
  7. function goThrough()
  8. {
  9.     for f in $(ls -A $1)
  10.     do
  11.         cale=$1/$f
  12.  
  13.         echo $cale
  14.  
  15.         if [ ${f:0:1} = . ] ; then
  16.             if [ ! -d $f ] ; then
  17.                 let count++
  18.             fi
  19.         fi
  20.         #echo -e $sir_indentare$cal
  21.  
  22.         if [ -d $cale ]  # daca-i director, apelam recursiv
  23.         then
  24.             let nrDir++;
  25.             goThrough $cale
  26.         fi
  27.     done
  28. }
  29.  
  30. if test $# -eq 0 ; then numedir=$(pwd) ; else numedir=$1 ; fi
  31.  
  32. goThrough $numedir   # apelul initial
  33. echo "Secrets: $count"
  34. echo "SubDirs: $nrDir"
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