On Fri, Aug 9, 2013 at 1:17 PM, Ruediger Meier <sweet_f_a@gmx.de> wrote:
You can source it from a shell which is a great advantage but you can do it differently if you prefer,
Well, it's not that. One would have to have root to inject stuff there.
The issue is that of coupling. Sourcing it as a script, means a tiny otherwise inconsequential formatting error there would break all the scripts that source it, and for what, when grep can do just fine?
Of course it's bad that it could crash. Moreover you have to take care that the file may contain variables which you are using already in your script.
On the other hand your grep line would parse the file incorrectly. Most important, you should ignore comments,
Well, you could improve the regex to exclude comments. But if the intent is to detect openSUSE, why would any other distro include the string "openSUSE", in comments or not?
I can imagine many real life cases where this could happen. Maybe I (or you) would leave such comment on my own system after I've tried something out while working on those scripts we are talking about.
Or what about a comment like this # add this strange openSUSE var to let xyz work on Debian STRANGE_KEY="bla"
Anyway, a comment has to be ignored. No need to discuss about the sense of this comment. It's only made for the human reader. ;)
Yeah, sure. So add grep -e -v '^ *#' Or something like that. Even the possibility of parsing some comments would be more robust than sourcing the file, IMHO. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org