不使用backtick处理参数

  backtick, the grave accent ( ` ) is a diacritic mark [wikipeida]。
  如果使用backtick,那么在unix shell中,可以方便地用'cat ini_file.ini'把配置文件中的内容取出,对于配置文件只有一行的情况。如果配置文件有多行,也可以使用shell工具取出某行的数据。
  放弃backtick方案。 仍使用GUI部分从配置文件读入参数,再作为批处理的命令行参数。配置文件准备使用多个,每个参数一个文件,方便使用fstream读入,避免使用windows api。
放弃backtick方案的原因如下。
  需要重写所用已用批处理实现的场景 ;

已经与袁福宇一起测试了可行性。
1.在shell中的使用方法。不是原文引用,可能有错。
  >test.exe -para `cat device_name.txt`
等同于执行
  >test.exe -para .EmeterDevice0
其中,'.EmeterDevice0'是device_name.txt的内容。
需要注意当前目录、配置文件目录。

2.在shell之外,由GUI调用的方法。
----引用开始
d:msys1.0bin>sh
sh-2.04$ exit
exit

d:msys1.0bin>sh test.sh
ok

d:msys1.0bin>cat test.sh
echo ok
d:msys1.0bin>
----引用结束

备忘,免得哪天又把这个方案想起来,然后再花上大半天否定它。

One thought on “不使用backtick处理参数”

  1. Thanκ you foг the auѕpicіouѕ writеup.

    It іn fact wаs a amusement accоunt it.

    Look aԁvanceԁ tо morе added agreеable frοm уou!
    Hoωever, hοw could we communicate?

    Here is mу homeρage - ipad repair malacca

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *