Advertisement
Guest User

Untitled

a guest
May 19th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. while getopts tcx: tmp
  2. do
  3. case $tmp in
  4. t) TFLAG=true
  5. words=`ls -l | grep '...x..x..x' | awk '{print $10}' | grep .txt$`
  6. if [ -n "$words" ]
  7. then
  8. echo $words
  9. else
  10. echo "No such file exists"
  11. fi
  12. ;;
  13. c) CFLAG=true
  14. words=`ls -l | grep '...x..x..x' | awk '{print $10}' | grep .c$`
  15. if [ -n "$words" ]
  16. then
  17. echo $words
  18. else
  19. echo "No such file exists"
  20. fi
  21. ;;
  22. x) XFLAG=true
  23. words=`ls -l | grep '...x..x..x' | awk '{print $10}' | grep "$OPTARG"`
  24. if [ -n "$words" ]
  25. then
  26. echo $words
  27. else
  28. echo "No such file exists"
  29. fi
  30. ;;
  31. esac
  32. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement