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 (39): « First ... « 15 16 17 18 [19] 20 21 22 23 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Liumberg
nervoso..sempre

User info:
Registered: Oct 2002
Posts: 53 (0.01 al dì)
Location: Bregnano -CO-
Corso: laurea triennale informatica
Anno: 3
Time Online: 1 Day, 2:08:00: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

mi sono appena accorto che non sono il solo ad avere questo problema

30-01-2008 07:50
Click Here to See the Profile for Liumberg Click here to Send Liumberg a Private Message Find more posts by Liumberg Add Liumberg to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mjfan80
.consigliere.

User info:
Registered: Nov 2001
Posts: 140 (0.02 al dì)
Location: Vallecamonica (BRESCIA)
Corso: Informatica quinquennale
Anno: 5°? 6°? 7°? bho
Time Online: 19:22:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

infatti, stesso problema, ho provato a sostiruire i cicli for con i while
loro funzionano... quelli che non devono "restituire" parametri vanno (come quello per aggiungere utenti)
e all'interno del ciclo i calcli funzionano (se vedi io prima con degli echo di controllo li faccio stampare a schermo, se li provi, vedi che alla fine dei cicli while, i valori sarebbero corretti
ma fuori dal ciclo... bhum, scompaiono

__________________
Heal The World
Just Because You Read It In A Magazine Or You See It On A Tv Scren Don't Make It Factual

30-01-2008 08:42
Click Here to See the Profile for mjfan80 Click here to Send mjfan80 a Private Message Visit mjfan80's homepage! Find more posts by mjfan80 Add mjfan80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
plafo
.illuminato.

User info:
Registered: Nov 2004
Posts: 236 (0.03 al dì)
Location: Milano
Corso: informatica
Anno: terzo
Time Online: 4 Days, 20:03:23 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

anch'io ho lo stesso problema e sto cercando una soluzione! :?

30-01-2008 09:18
Click Here to See the Profile for plafo Click here to Send plafo a Private Message Find more posts by plafo Add plafo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

mi aggrego al vostro problema...

Non è che bisogna usare in qualche modo particolare expr ??

ovvero : io expr l'ho visto usare :

SUM=$(expr $i+$c)
oppure
SUM='expr $i+$c'
oppure
SUM=[expr ${i}+${c}]
.
.
.

sono modi diversi per fare la stessa cosa oppure hanno un significato preciso??

grazie e ciaooo

30-01-2008 12:40
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mjfan80
.consigliere.

User info:
Registered: Nov 2001
Posts: 140 (0.02 al dì)
Location: Vallecamonica (BRESCIA)
Corso: Informatica quinquennale
Anno: 5°? 6°? 7°? bho
Time Online: 19:22:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

no bullet
expr va, se fai girare il mio script te ne accorgi, la somma funziona, e stampa ogni volta una somma incrementale, quindi funziona... soloc eh fuori dal while torna a valere zero

__________________
Heal The World
Just Because You Read It In A Magazine Or You See It On A Tv Scren Don't Make It Factual

30-01-2008 12:50
Click Here to See the Profile for mjfan80 Click here to Send mjfan80 a Private Message Visit mjfan80's homepage! Find more posts by mjfan80 Add mjfan80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Come a me...Stessa cosa ... è come se le inizializza a zero quando finisce il ciclo...ke nervossoooooo....

30-01-2008 13:02
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho scoperto una cosa :

sto facendo lo script per trovare per ogni utente l'ocupazione in kb

#!/bin/sh
SUM=0
(cat /etc/passwd | cut -d : -f 3 |sort -n |uniq) |wile read id ;do
(find / -type f -user $id | xargs du | cut -f 1) | while read Sz ; do

SUM=$(expr $SUM + $ Sz)

done

echo " user $id spazio :$Sz"
done


ho scoperto questo: se cambio il valore a cui inizializzo SUM cambia pure il valore di uscita dal while ovvere mette il valore ke uso per inizializzare.

ho scritto a monga peravere dei chiarimenti sul while...

se scoprite qualcosa scriveteeeeee...

30-01-2008 13:20
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

nell'echo non $Sz ma $SUM

30-01-2008 13:21
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Liumberg
scusate..
sto cercando di risolvere il problema "out of space" dei cicli FOR
usando while,il problema è che il sistema sembra dimenticare il contenuto delle variabili che vengono usate appena si esce da ciclo

nel seguente script (calcola lo spazio occupato dall'utente root) il valore della variabile TEMP alla fine è sempre 0.


TEMP=0
find ./ -type f -user root|xargs du|cut -f 1|while read FILE
do
TEMP='expr $TEMP \+ $FILE'
done
echo "occupazione utente root : $TEMP"

qualcuno sa aiutarmi?
ho paura che domani mi prendo una denuncia per aggressione..


Io ho fatto così:

#!/bin/sh
dimensione=0
somma=0
for dimensione in $(find / -type f -user 0 -exec ls -s {} \; | cut -f 1 -d " ");
do
somma=$(expr $somma + $dimensione)
done;
echo La somma dei file di root è: $somma

30-01-2008 13:25
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Anche a me funziona tutto se uso il for
ma alle volte il for ti può dare problemi di out of space che il while nn da.... misteri di minix

30-01-2008 13:28
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

il problema è la localizzazione delle variabili.
la variabile TEMP esterna al ciclo di while non è la stessa TEMP all'interno del ciclo.
Infatti se metti una echo nel ciclo il TEMP viene valorizzato correttamente.
Si può, non molto elegantemente, risolver usando il filesystem così:


#!/bin/sh
somma=0
find / -type f -user 0 -exec ls -s {} \; | cut -f 1 -d " "|while read FILE
do
somma=$(expr $somma + $FILE)
echo $somma > ./tmp
done;
somma=$(cat ./tmp)
rm ./tmp
echo La somma dei file di root è: $somma

30-01-2008 14:19
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
bullet
.fedelissimo.

User info:
Registered: Oct 2004
Posts: 44 (0.01 al dì)
Location: busnago
Corso: informatica
Anno: 2
Time Online: 11:13:32 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

quindi quando uso il while e modifico una variabile dichiarata all'esterno di esso il valore modificato vale solo all'interno del while
giusto??

Grazie
ciaoo ciao

30-01-2008 14:50
Click Here to See the Profile for bullet Click here to Send bullet a Private Message Visit bullet's homepage! Find more posts by bullet Add bullet to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

esatto.

30-01-2008 14:51
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mjfan80
.consigliere.

User info:
Registered: Nov 2001
Posts: 140 (0.02 al dì)
Location: Vallecamonica (BRESCIA)
Corso: Informatica quinquennale
Anno: 5°? 6°? 7°? bho
Time Online: 19:22:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ma come mai il while si comporta quasi come se fosse una funzione (quindi con le proprie variabili interne?
se non arrivavi tu a dircelo, di questo comportamento (avremmo potutto capirlo e quindi usar comunque il file, ma insomma) dovre avremmo dovuto impararlo?
è così con linux normalmente o solo minix?
mi sa che prima proverò con i for e se creano problemi faro questi while + file
(un po' la soluzione che avevo usato in uno script un po' indietro)

domanda forse stupida, perchè il file è ./temp e non semplicemente temp?

__________________
Heal The World
Just Because You Read It In A Magazine Or You See It On A Tv Scren Don't Make It Factual

30-01-2008 14:54
Click Here to See the Profile for mjfan80 Click here to Send mjfan80 a Private Message Visit mjfan80's homepage! Find more posts by mjfan80 Add mjfan80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
jeremy.1983
allinuxato

User info:
Registered: Sep 2006
Posts: 42 (0.01 al dì)
Location: Saronno
Corso: Informatica
Anno: no comment
Time Online: 19:30:58 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by zonker
[...]
#!/bin/sh
somma=0
find / -type f -user 0 -exec ls -s {} \; | cut -f 1 -d " "|while read FILE
do
somma=$(expr $somma + $FILE)
echo $somma > ./tmp
done;
somma=$(cat ./tmp)
rm ./tmp
echo La somma dei file di root è: $somma


Il tuo script funziona se gli utenti hanno dei file.

Ci sono utenti (come 9998 o 9999) che non hanno file nel sistema, l'output per loro dovrebbe essere 0 ma non entrando mai nel while non si genera la variabile temporale incappando nel No such file or directory.

Comunque mi pare sia l'unica soluzione, per cui penso che farò così domani, se mi capiterà una roba del genere

30-01-2008 14:55
Click Here to See the Profile for jeremy.1983 Click here to Send jeremy.1983 a Private Message Find more posts by jeremy.1983 Add jeremy.1983 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 21:33.    Post New Thread    Post A Reply
Pages (39): « First ... « 15 16 17 18 [19] 20 21 22 23 » ... 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.144 seconds (31.48% PHP - 68.52% MySQL) con 23 query.