【发布时间】:2016-03-09 13:13:17
【问题描述】:
我有两个文件,分别是 file1.sh 和 file2.sh。
file1.sh 包含 DB2 查询,该查询返回员工表中的员工总数。
现在我想将员工总数分配到文件file1.sh 中的一个变量中。
文件 1:
#!/bin/bash
#database connection goes here
echo The total number employees:
db2 -x "select count(*) from employee"
当我在上面运行显示员工总数的文件时。
但是
我想将该总数存储到某个变量中,并希望它可以从另一个文件file2.sh 访问。
文件 2:
#!/bin/bash
#Here i want to use total number of employees
#Variable to be accessed here
【问题讨论】: