Advertisement
Guest User

Untitled

a guest
Mar 20th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. bash-4.2$ jobscount() {
  2. > local stopped=$(jobs -sp | wc -l)
  3. > local running=$(jobs -rp | wc -l)
  4. > ((running+stopped)) && echo -n "${running}r/${stopped}s "
  5. > }
  6.  
  7. bash-4.2$ PS1=' \w $(jobscount)\$ '
  8.  
  9. ~ $ jobs
  10.  
  11. ~ $ sleep 100 &
  12. [1] 2325
  13.  
  14. ~ 1r/0s $ sleep 110 &
  15. [2] 2333
  16.  
  17. ~ 2r/0s $ jobs
  18. [1]- Running sleep 100 &
  19. [2]+ Running sleep 110 &
  20.  
  21. ~ 2r/0s $ sleep 120
  22. ^Z
  23. [3]+ Stopped sleep 120
  24.  
  25. ~ 2r/1s $ jobs
  26. [1] Running sleep 100 &
  27. [2]- Running sleep 110 &
  28. [3]+ Stopped sleep 120
  29.  
  30. ~ 2r/1s $ bash --version
  31. GNU bash, version 4.2.42(1)-release (i686-frugalware-linux-gnu)
  32. Copyright (C) 2011 Free Software Foundation, Inc.
  33. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  34.  
  35. This is free software; you are free to change and redistribute it.
  36. There is NO WARRANTY, to the extent permitted by law.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement