Advertisement
Korsar13

strange thing

Jun 9th, 2022
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. [[ -d xyz ]] && rm -rf xyz
  4. mkdir -p xyz/foo
  5.  
  6. res=0
  7. failed=0
  8. ls -d xyz/* | while read d ; do
  9.   echo "d=$d"
  10.   if [[ -f "xyz/$d/notexisting" ]] ; then
  11.     echo "OK"
  12.   else
  13.     res=1
  14.     failed=1
  15.     echo "Failed"
  16.     exit 1
  17.     echo "Still alive?"
  18.   fi
  19. done
  20.  
  21. echo "res=$res failed=$failed"
  22.  
  23. rm -rf xyz
  24.  
  25. exit $res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement