[pso] [tema2][lin] test - problema cu grep

Andrei Trandafir andreitra1987 at yahoo.com
Sat Apr 3 21:31:25 EEST 2010


Merci de clarificare.
Intr-adevar, am modificat symlink-ul a.i. sa trimita la bash in loc de dash si acum testerul functioneaza corect.

Off-topic...Happy Easter :D

--- On Sat, 4/3/10, Catalin Moraru <catalin.me at gmail.com> wrote:

> From: Catalin Moraru <catalin.me at gmail.com>
> Subject: Re: [pso] [tema2][lin] test - problema cu grep
> To: "Proiectarea Sistemelor de Operare" <pso at cursuri.cs.pub.ro>
> Date: Saturday, April 3, 2010, 6:54 AM
> > De
> > asemenea `> /dev/null 2>&1' si `&>
> /dev/null' sunt sintaxe
> > echivalente. Vezi `man bash' pentru mai multe
> informatii.
> 
> Sa luam urmatorul program de test:
> 
> #include <stdio.h>
> #include <stdlib.h>
> int main(void){
>     printf("ret1=%d\n",  system("cat
> /proc/ioports | grep \"Happy
> Easter\" > /dev/null 2>&1"));
>     printf("ret2=%d\n",  system("cat
> /proc/ioports | grep \"Happy
> Easter\" &> /dev/null"));
>     return 0;
> }
> 
> Testez umatorul program pe masina virtuala actuala (Ubuntu
> 9.10):
> 
> root at spook:~/tema2/test# ./a.out
> ret1=256
> ret2=0
> 
> 
> Acelasi program de test pe masina virtuala veche (Gentoo):
> 
> spook ~ # ./a.out
> ret1=256
> ret2=256
> 
> Cauza este faptul ca pe Ubuntu 9.10 /bin/sh e de fapt
> /bin/dash
> in timp ce pe Gentoo /bin/sh este /bin/bash
> 
> /bin/dash interpreteaza & direct ca background cmd.
> ( nu o sa faca redirectarea dubla &> )
> 
> More info here:
> http://princessleia.com/plug/2008-JP_bash_vs_dash.pdf
> 
> 
> Numai bine,
> 
> Catalin
> _______________________________________________
> pso mailing list
> pso at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
> 


      


More information about the pso mailing list