Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > Esame di laboratorio (Giugno 2007) - Domande Thread Rating: 3 votes, 5.00 average.
Pages (571): « First ... « 137 138 139 140 [141] 142 143 144 145 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ma dove li trovi questi orrori ???

code:
#!/bin/sh MAXSIZE=0 MAXPID=0 for PROC in $(ps alx | tr -s ' ' : | cut -d : -f 5,8); do PID=$(echo $PROC | cut -d : -f 1) SIZE=$(echo $PROC | cut -d : -f 2) if [ $PID % 2 -eq 1 -a $SIZE -gt $MAXSIZE ]; then MAXPID=$PID MAXSIZE=$SIZE fi done echo "Processo con PID dispari più esoso: $MAXPID con $MAXSIZE KB"

Spiegazione:
  • Dalla lista di tutti i processi comprimo tutti gli spazi contigui nel carattere ':' che userò come separatore di colonne (lo spazio faceva danno); estraggo le colonne 5 e 8 che sono PID e SIZE (anche qui trovate osservando il comportamento dei comandi)
    Le righe ora sono della forma PID:SIZE (12:552)
  • Estraggo i PID come prima colonna dalla variabile PROC
  • Estraggo i SIZE come seconda colonna dalla variabile PROC
  • Se il PID % 2 è uguale a 1 (dispari) e SIZE è maggiore di MAXSIZE
  • Aggiorno il PID e il SIZE massimi

__________________
The answer is blowing in the wind...

Last edited by n3o on 19-07-2007 at 20:35

19-07-2007 20:19
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 16:34.    Post New Thread    Post A Reply
Pages (571): « First ... « 137 138 139 140 [141] 142 143 144 145 » ... Last »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.186 seconds (24.54% PHP - 75.46% MySQL) con 23 query.