这是我的个人壳的“头文件” tool.h如何导入shell的库源文件
#!/bin/echo Warnning! this libiary must be scourced in file!
#ostype(): define the system type in val OSTYPE
ostype(){
osname=`uname -s`
echo $osname
}
ostype
当我直接调用它,./tool.h
它打印的第一行#后”!/ bin中/回声“
这里是我的问题:如何通过anoter shell脚本文件在第一行#!/bin/bash
中的'tool.h'中调用此函数”ostype“?
我不知道如何导入“头文件”,就像在Javascript中导入Jquery插件一样。
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
请勿为shell脚本文件使用后缀'.h'; '.h'用于C和C++头文件。使用'.sh'。 –
你真的不应该命名你的文件'tool.h',因为它不是C/C++头文件。 – ObscureRobot
你为什么在shebang中使用'#!/ bin/echo'? '#!/ bin/sh'会更明智。 –