shell脚本也可以包含文件
格式: . filename
或者source filename
举例:
a.sh
#!/bin/sh
calla()
{
echo "a.sh is called"
}
b.sh
#!/bin/sh
. ./a.sh
echo "exec b.sh
calla
chmod +x b.sh
./b.sh
>>> exec b.sh
>>> a.sh is called
原文:http://www.cnblogs.com/techdreaming/p/5224575.html