tpsu - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
tpsu (463B)
---
     1 #!/bin/sh
     2 
     3 flag=''
     4 if [ "x$1" = "x-a" ]
     5 then
     6         flag=-a
     7         shift
     8 fi
     9 
    10 case $# in
    11 0)
    12         user=$USER
    13         ;;
    14 1)
    15         user=$1
    16         ;;
    17 *)
    18         echo 'usage: psu [-a] [user]' 1>&2
    19         exit 1
    20 esac
    21 
    22 9 ps $flag | grep "^$user " | awk '
    23         BEGIN { min = 1000000 };
    24         { 
    25                 line[0+nline++] = $0;
    26                 n = length;
    27                 sub(/ +/, "", $0);
    28                 n -= length;
    29                 if(n < min)
    30                         min = n;
    31         }
    32         END{
    33                 s = "";
    34                 for(i=0; i