我是shell脚本的新手,并尝试为包含多个组的属性文件创建模板。我找到了许多用于创建简单属性文件的链接,但是他们可以使用模板在属性文件中创建组。
属性文件应如下所示:
EditText firstNumber;
EditText secondNumber;
TextView addResult;
Button btnAdd;
double num1, num2, sum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firstNumber = (EditText) findViewById(R.id.txtNumber1);
secondNumber = (EditText) findViewById(R.id.txtNumber2);
addResult = (TextView) findViewById(R.id.txtResult);
btnAdd = (Button) findViewById(R.id.btnAdd);
final Button mButton = (Button) findViewById(R.id.btnAdd);
mButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
num1 = Double.parseDouble(firstNumber.getText().toString());
num2 = Double.parseDouble(secondNumber.getText().toString());
sum = num1 + num2;
addResult.setText(Double.toString(sum));
}
});
}
答案 0 :(得分:0)
您可以将下一个代码的输出重定向到文件(在最后> template.txt
后附加done
)。
for group in dev qa prod; do
echo "[${group}]"
for key in JDBC_URL JDBC_USERNAME JDBC_PASSWORD SERVICE_ENDPOINT; do
echo "${key} ="
done
# additional blank line
echo
done