Le Jeudi, 5 Février 2004 13.27, fisch a écrit :
> I have a problem with su, wich I can't understand.
> in /home/myself/.profile I defined TEST001=/tmp
> as root I do (1st case):
> su - myself
> echo $TEST001
> OUTPUT: /tmp
> as root I do (2nd case):
> su - myself -c "echo $TEST001"
> OUTPUT:     (empty)
>
> where is the difference?

it's not a su problem, but a shell problem.
$TEST001 is expanded at the time su is executed, and it's undefined at that 
moment, so your command is really:
# su - myself -c "echo"
you should escape the $ or use simple quotes instead of double ones, or add 
the "echo $TEST001" in your .profile if you just want to test id $TEST001 is 
defined.

hth

-- 
mathieu perrenoud

--
[EMAIL PROTECTED] mailing list

Reply via email to