Advertisement
phuongnx

C5_10

Jun 19th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. #!/bin/bash
  2. echo "nhap thu muc: "
  3. read dir
  4. if test -d $dir
  5. count=0
  6. then
  7.     for line in $(ls -l $dir | grep -v 'd' | awk '$1 != "total" {print $1}')
  8.     do
  9.         count=$(( $count + 1 ))
  10.     done
  11.     echo "Trong "$dir" co: "$count" thu muc con"
  12. else
  13.     echo "thu muc khong ton tai"
  14. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement