Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. Help(){
  4. echo "Hello!"
  5. echo "This script finds all the subfolders of the first level, which is not open any file."
  6.  
  7. exit
  8. }
  9. Solution(){
  10.  
  11. find "$dir" -mindepth 1 -maxdepth 1 -type d '!' -exec sh -c "lsof +d {} | grep -q ''" \; -print
  12. }
  13. dir=$1
  14.  
  15. if [ -z $1 ]; then dir=$(pwd); fi
  16. if [[ $1 = "--help" || $1 = "-h" ]]; then Help; fi
  17. if [[ -d "$dir" ]]; then Solution; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement