Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. while true; do
  4. sleep 1
  5. echo "Slept 1"
  6. echo "Exit status $?, ok."
  7. sleep 1
  8. echo "Slept 1, now executing faulty command 'ps q'"
  9. ps q
  10. echo "Exit status $?, not ok. Loop continues forever..."
  11. done
  12.  
  13. ./loop.sh
  14. Slept 1
  15. Exit status 0, ok.
  16. Slept 1, now executing faulty command 'ps q'
  17. ps: illegal option -- q
  18. usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
  19. [-u]
  20. [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
  21. ps [-L]
  22. Exit status 1, not ok. Loop continues forever...
  23. Slept 1
  24. Exit status 0, ok.
  25. Slept 1, now executing faulty command 'ps q'
  26. ps: illegal option -- q
  27. usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
  28. [-u]
  29. [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
  30. ps [-L]
  31. Exit status 1, not ok. Loop continues forever...
  32. ^C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement