/etc/launchd.conf setenv value containing whitespace

In my /etc/launchd.conf file, I added these lines in an effort to figure out exactly how to create globally scoped environment variables whose values contain whitespace.

setenv foo1 123456
setenv foo2 "123456"
setenv foo3 123\ 456
setenv foo4 "123\ 456"
setenv foo5 "123 456"
setenv foo6 "123\\ 456"
setenv foo7 '123456'
setenv foo8 '123 456'
setenv foo9 '123\ 456'
setenv foo10 '123\\ 456'

To see what stuck and what the results were, I ran set | grep foo. The result:

foo1=123456
foo2='"123456"'
foo7=''\''123456'\'''

I'm out of ideas. Is this even possible? If so, what's the syntax?


Solution 1:

Use export instead of setenv.

export foo1=123456
export foo2="123456"   # foo2 should now have the same value as foo1   
export foo3=123\ 456
export foo4="123 456"  # foo4 should now have the same value as foo3