~ubuntu-branches/debian/wheezy/byobu/wheezy

« back to all changes in this revision

Viewing changes to usr/lib/byobu/users

  • Committer: Package Import Robot
  • Author(s): Alexander Chernyakhovsky
  • Date: 2012-01-11 19:37:34 UTC
  • mfrom: (0.5.3) (0.1.162 precise)
  • Revision ID: package-import@ubuntu.com-20120111193734-89083z97py39gj05
Tags: 5.2-1
* Syncing from Ubuntu. Remaining changes:
  - Switch to dh short syntax
  - Added a substvar ${perl:Depends} dependency into debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
__users() {
29
29
        local count
30
 
        # Note: we'd like to use pgrep -c, however, this isn't available in
31
 
        # busybox and some distro's pgrep (and it doesn't exit non-zero).
32
 
        count=`pgrep -f "sshd:.*@" | wc -l` || return
 
30
        if [ "$USERS_DISTINCT" = "1" ]; then
 
31
                count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
 
32
        else
 
33
                # Note: we'd like to use pgrep -c, however, this isn't available in
 
34
                # busybox and some distro's pgrep (and it doesn't exit non-zero).
 
35
                count=$(pgrep -f "sshd:.*@" | wc -l) || return
 
36
        fi
33
37
        if [ $count -gt 0 ]; then
34
38
                color b w r; printf "%d" "$count"; color -; color w r; printf "#"; color --
35
39
        fi