Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bash-4.2$ jobscount() {
- > local stopped=$(jobs -sp | wc -l)
- > local running=$(jobs -rp | wc -l)
- > ((running+stopped)) && echo -n "${running}r/${stopped}s "
- > }
- bash-4.2$ PS1=' \w $(jobscount)\$ '
- ~ $ jobs
- ~ $ sleep 100 &
- [1] 2325
- ~ 1r/0s $ sleep 110 &
- [2] 2333
- ~ 2r/0s $ jobs
- [1]- Running sleep 100 &
- [2]+ Running sleep 110 &
- ~ 2r/0s $ sleep 120
- ^Z
- [3]+ Stopped sleep 120
- ~ 2r/1s $ jobs
- [1] Running sleep 100 &
- [2]- Running sleep 110 &
- [3]+ Stopped sleep 120
- ~ 2r/1s $ bash --version
- GNU bash, version 4.2.42(1)-release (i686-frugalware-linux-gnu)
- Copyright (C) 2011 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- This is free software; you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement