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 ... « 54 55 56 57 [58] 59 60 61 62 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
NoWhereMan
.illuminato.

User info:
Registered: Jul 2003
Posts: 222 (0.03 al dì)
Location: Segrate (MI)
Corso: Dottorato in Informatica
Anno:
Time Online: 1 Day, 21:56:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

1) Per me un file è eseguibile se lo è per tutti (altrimenti farsi tutti i casi possibili è una macello...)


ecco una regex:
ls -l | grep '^[rw-]*x'
o anche (tenuto presente che x non compare mai all'inizio)
ls -l | grep '^[rw-]\+x' # non chiedetemi perché bisogna fare escape del + e non di *

trova tutti gli elementi della lista in cui all'inizio c'è una permutazione qualsiasi di (r,w,-) N volte seguita da un x. Il match è ovviamente al primo x trovato

naturalmente, 20 minuti solo per trovare la regex, quindi impossibile durante l'esame :D (e tra l'altro se non avessi detto tu la cosa del ls -l io starei ancora qui a smanettare con find . -perm che non va :D non mi vengono in mente altri sistemi...).

non per altro, è che ogni comando ha la sue particolari necessità di escaping quindi uno devi fare \+ un altro \{ mah...

peccato che nell'esame di LFA non ci sia un bel test di regex pratico :P


@antares85: in teoria le conti, ma occhio, perché nell'output di ps le colonne non sono sempre nello stesso numero (anche se sembra dalla formattazione) in alcuni casi hai (ad es)

code:
10 S 0 1 5 1 16 (wait) pm ? 0:00 init


(intuitiv. 10 colonne, in realtà (wait) pm sono DUE!)

in altri:
code:
10 W 0 26 5 1 16 pm ? 0:00 /usr/sbin/inet


10 colonne

o, peggio

code:
10 W 0 26 5 1 16 fs co 0:00 ps alx


intuitivamente 10 colonne, ma in realtà 11 (ps alx)

insomma una porcheria.

su linux che ho (ma stando a man sembrerebbe un'implementazione moderna comune immagino ad altri unix), ps è un po' meglio perché i campi vuoti sono contrassegnati almeno da un trattino;

nel nostro caso a parte estrarre il field del PID e in generale i primi 7 campi, dall'8 in poi si rischia :/

forse quello di minix è custom (e/o vecchio)

13-07-2007 22:03
Click Here to See the Profile for NoWhereMan Click here to Send NoWhereMan a Private Message Visit NoWhereMan's homepage! Find more posts by NoWhereMan Add NoWhereMan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 02:29.    Post New Thread    Post A Reply
Pages (571): « First ... « 54 55 56 57 [58] 59 60 61 62 » ... 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.051 seconds (49.40% PHP - 50.60% MySQL) con 24 query.