|
From: <bc...@wo...> - 2001-11-15 09:03:32
|
[Kevin] >How about this? >... Committed. >If a subsequent line has an equals sign, this code will treat it as a new >variable assignment. We could get complex and define what characters are >valid in shell variable names, but there would still be cases where it >wouldn't work (e.g., X='My\nname=Kevin') > >I think allowing some multi-line variables is useful, and handling the other >multi-liners w/o raising errors is helpful. Indeed. Still, we end up with a corrupt environment and when passed to os.system() it may cause other errors. Such as when PATH is reset: X='My\nPATH=Kevin' [In cygwin I had actually enter ctrl-M ctrl-J at the command prompt to include a CRLF in the output of "cmd.exe /c set"] So it seems like "cmd.exe /c set" is loosing the significant embedded newline. Is this also the case for "sh -c env" on unixes? I suspect it is. It appears that the bash builtin "set" command writes its output in a way that can be used for input. So while commands we execute now must remain the portable default, we could have a mode that uses "bash -c set" and convert the output back into real values: X=$'My\nPATH=Kevin' It seems it would have to deal with the $'..' and backslash quoting. It is not a requirement to fix this far-fetched problem before beta1. regards, finn |