env variables with spaces

Net Llama! netllama
Wed Feb 28 07:35:55 PST 2007


On Wed, 28 Feb 2007, C M Reinehr wrote:
> On Tuesday 27 February 2007 18:22, Net Llama! wrote:
>> I'm running into an annoying problem.  I'm taking the output from 'env'
>> and dumping it to a file (/tmp/env.out), and then running 'source
>> /tmp/env.out'.  The problem is that some of the variables in env output
>> have values assigned to them with spaces, such as:
>> FOO=release debug
>>
>> When source hits this, it gets confused and assumes that the ' debug'
>> portion is something separate from the value of FOO, and barfs:
>> bash: release: command not found
>>
>> Anyone have any suggestions how to get around this?  thanks
>
> Perhaps you could redefine the IFS environment variable just to <newline>
> instead of the default <space><tab><newline> before running source.

Actually, Kurt suggested this to me on the irc channel, but I couldn't get 
it to work at all.  At this point, I think I'm going to give Bill's sed 
solution a try, as it looks the most promising.  One thing that I failed 
to mention initially is that I need this to also work under cygwin, and 
there's no pythong there (as far as I can tell), so sed would be the best 
cross platform solution.


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman                        netllama at linux-sxs.org
LlamaLand				http://netllama.linux-sxs.org



More information about the Linux-users mailing list