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 > sommare con la shell di minix una lista di numeri
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
jaguaro
.consigliere.

User info:
Registered: Jun 2006
Posts: 108 (0.02 al dì)
Location: Milano
Corso: STCM
Anno:
Time Online: 11:05:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
sommare con la shell di minix una lista di numeri

non mi è molto chiaro come fare...
ho fatto un po' di prove con expr, variabili e file ma non sono giunto ad una soluzione..

es.

file numbers
1
43
6
3
87
3
8
5
9


se voglio sommarli?

__________________
Carlo Boni
Rappresentante Studenti
Sinistra Universitaria

23-07-2008 15:55
Click Here to See the Profile for jaguaro Click here to Send jaguaro a Private Message Visit jaguaro's homepage! Find more posts by jaguaro Add jaguaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

http://www.dsy.it/forum/showthread....5&pagenumber=22

solo che se stampo sum mi visualizza:

esempio fatto con sum=0 e tmp=1234

0+1
0+2
0+3
0+4

e non mi fa la somma

Last edited by Gehur on 23-07-2008 at 19:28

23-07-2008 19:19
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ecco..

Attachment: img.jpg
This has been downloaded 25 time(s).

23-07-2008 19:37
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ideafix
.grande:maestro.

User info:
Registered: Oct 2004
Posts: 953 (0.12 al dì)
Location: Melegnano (MI)
Corso: Informatica
Anno: Dottore!
Time Online: 27 Days, 3:08:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho avuto lo steso problema è solo un problema di spazii!!!

se invece di

S=$(expr $S+$N)

scrivi

S=$(expr $S + $N) funziona :|

23-07-2008 20:22
Click Here to See the Profile for ideafix Click Here to See the Blog of ideafix Click here to Send ideafix a Private Message Find more posts by ideafix Add ideafix to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Gehur
.grande:maestro.

User info:
Registered: Apr 2006
Posts: 519 (0.07 al dì)
Location: Milano
Corso: Informatica
Anno:
Time Online: 3 Days, 0:41:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ok grazie

23-07-2008 20:34
Click Here to See the Profile for Gehur Click here to Send Gehur a Private Message Find more posts by Gehur Add Gehur to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
jaguaro
.consigliere.

User info:
Registered: Jun 2006
Posts: 108 (0.02 al dì)
Location: Milano
Corso: STCM
Anno:
Time Online: 11:05:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie mille davvero!
non avevo pensato al cat nel in del for!

la riassumo qua per velocità di lettura dei posteri:

code:
#!/bin/sh sum=0 for tmp in $(cat numbers); do sum=$(expr $sum + $tmp); echo $sum; done

__________________
Carlo Boni
Rappresentante Studenti
Sinistra Universitaria

23-07-2008 21:48
Click Here to See the Profile for jaguaro Click here to Send jaguaro a Private Message Visit jaguaro's homepage! Find more posts by jaguaro Add jaguaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 07:26.    Post New Thread    Post A Reply
  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.115 seconds (59.87% PHP - 40.13% MySQL) con 26 query.