HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
And other languages, Shell may also contain external script. This makes it easy to package some common code as a separate file.
Shell syntax file contains the following:
. filename # 注意点号(.)和文件名中间有一空格 或 source filename
Create two shell script files.
test1.sh code is as follows:
#!/bin/bash # author:本教程 # url:www.w3resource.net url="https://w3resource.net/"
test2.sh code is as follows:
#!/bin/bash # author:本教程 # url:www.w3resource.net #使用 . 号来引用test1.sh 文件 . ./test1.sh # 或者使用以下包含文件代码 # source ./test1.sh echo "本教程官网地址:$url"
Next, we add to test2.sh executable permissions and perform:
$ chmod +x test2.sh $ ./test2.sh 本教程官网地址:https://w3resource.net
Note: The file does not need to be included test1.sh executable permissions.