這是我的個人殼的「頭文件」 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'會更明智。 –