[so] [Linux] Comportament ciudat variabile de mediu

Bogdan Sass bogdan.sass at catc.ro
Sat Mar 28 23:27:21 EET 2009


ana-maria lepar wrote:
>
> Concluzia mea (nu stiu daca este corecta in totalitate) :
>   - deja cand ii dau ca parametru $HOME, el face interpretarea si in 
> argv[1] nu imi va stoca $HOME ci chiar valorea variabilei si pe urma 
> va face un getenv("/home/so") si nu o va gasi si va intoarce 0
    Asa este. Expandarea argumentelor date in linia de comanda este 
facuta de shell, iar programul tau vede doar rezultatul.

    Poti evita expandarea respectiva dand comanda in forma
$myprogram '$HOME'

-- 
Bogdan Sass
CCAI,CCSP,JNCIA-ER,CCIE #22221 (RS)
Information Systems Security Professional
"Curiosity was framed - ignorance killed the cat"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090328/cd262a7e/attachment.bin>


More information about the so mailing list