TBG variable wrong but no error
When using the following tbg variable
TBG_radiation="--eG_radiation.period 1 --eG_radiation.dump 100 \
--eG_radiation.totalRadiation \
--eG_radiation.lastRadiation
--e_radiation.start 20000 --e_radiation.end 40000 "
with a missing \ in third line, tbg still creates an output file but without the fourth line and it didn't throw and error.
@macdre141 Welcome to GitHub and PIConGPU! Thanks for committing your first issue :+1:.
@psychocoderHPC Is this the intended behavior of tbg?
Hm, complicated. That's just "bash" and a similar
#!/usr/bin/env bash
TBG_radiation="--eG_radiation.period 1 --eG_radiation.dump 100 \
--eG_radiation.totalRadiation \
--eG_radiation.lastRadiation
--e_radiation.start 20000 --e_radiation.end 40000 "
echo $TBG_radiation
does indeed output
--eG_radiation.period 1 --eG_radiation.dump 100 --eG_radiation.totalRadiation --eG_radiation.lastRadiation --e_radiation.start 20000 --e_radiation.end 40000
Also, your last line
--e_radiation.start 20000 --e_radiation.end 40000
has an error e instead of eG which is something tbg cannot catch since it's a logic bug.
Hm, complicated. That's just "bash" and a similar
#!/usr/bin/env bash TBG_radiation="--eG_radiation.period 1 --eG_radiation.dump 100 \ --eG_radiation.totalRadiation \ --eG_radiation.lastRadiation --e_radiation.start 20000 --e_radiation.end 40000 " echo $TBG_radiationdoes indeed output
--eG_radiation.period 1 --eG_radiation.dump 100 --eG_radiation.totalRadiation --eG_radiation.lastRadiation --e_radiation.start 20000 --e_radiation.end 40000
Even if this works with normal bash I am not sure if we can handle it in tbg. The problem is that we need to detect multi line arguments and transform them internally. We should keep this issue open but I give it a low priority since it is an ill formatted input.
@ax3l Yes, there is a bug in there that should have caused a crash at start time - but thus it ran (without the extra flags).
The question is also a bit why we even need the \. Pure bash does not need line-continuation to define multi-line strings. (And it's a common source of error for our users.)
#!/usr/bin/env bash
A="Hey,
hey yo,
hey jo!"
echo $A
Hey, hey yo, hey jo!
I do not remember why. We can check if we can skip the backslash
Am 31. Oktober 2018 12:45:03 MEZ schrieb Axel Huebl [email protected]:
The question is also a bit why we even need the
\. Pure bash does not need line-continuation to define multi-line strings. (And it's a common source of error for our users.)-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/ComputationalRadiationPhysics/picongpu/issues/2775#issuecomment-434656625
@macdre141 may I ask you for a little favor? Since you are PIConGPU pro's now and we are trying to run as well on Stampede2, can you please add yourselves to our community map? :) Thanks a lot! cc @n01r (live map)
For future reference (and because I am too lazy to add a documentation section):
The snippet you are looking for is the following:
var_with_newlines="
--option1
--option2 arg
"
# replace newlines by spaces, see sed(1)
TBG_var=$(sed -z 's/\n/ /g' <<< "$var_with_newlines")
@psychocoderHPC will you implement such a sed code into tbg - otherwise we should perhaps close this issue?
Oh I would +1 for implementing it or printing a warning, got hurt by it today
@psychocoderHPC ping?