English 中文(简体)
D. 选择不托管的组合
原标题:Loading untrusted configurations variable

我正致力于一个迅速项目,该项目在你目前掌握的名录中针对不同国家采取行动。

现在需要的是把一个小型组合从目前的名录上排出,这很容易用<代码>。 .。

What is the best way of loading variables from a file like this? The variables is going to be mostly in a true/false state, so I am not parsing them in any way so it can be executed.

可能的解决办法:

  • 一种循环,把每个预先界定的变量装上,是可能的,但我希望以可读的方式保留该守则。

  • 说一篮子里的整个档案是最佳解决办法,但我怎么能够把钥匙/价值字塔放在像这样的篮子里?

  • 如果沥滤能够产生一个只装载变量的文档。

我很想知道准武器的形式。 议事档案将照样。 但我认为最容易的是按空间分列的每一段的一条线。 如同每一行中的一条:<代码>可在内有空间的关键值。

最佳回答

可在上安全隐蔽的,并且仍然可以执行恶意守则。 最好使用<代码>declare:

while read varname value
do
    declare "$varname=$value"
done < .params.conf
问题回答

如果贵方的价值观不包含引文,那就非常容易:

while read varname value ; do
    eval $varname=" $value "
done < .params.conf

如果在变量中引用的话,你必须更加谨慎,增加一些决定因素。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签