How to call and reference another script file in a Shell script
This article mainly explains "how to call and quote another script file in a Shell script". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to call and quote another script file in a Shell script".
Script first (test example 1)
The code is as follows:
#! / bin/bash
Echo 'your are in first file'
Q) call another script file in the current script file?
Method 1: use source
Script second (test sample 2)
The code is as follows:
#! / bin/bash
Echo 'your are in second file'
Source first
Method 2: use.
Script second (test sample 3)
The code is as follows:
#! / bin/bash
Echo 'your are in second file'
. First
Source filename and. Filename should be the same thing, executing scripts in the * current * Shell environment. You can also use sh filename, which executes the script in the child Shell of the current Shell.
Thank you for your reading, the above is the content of "how to call and reference another script file in the Shell script". After the study of this article, I believe you have a deeper understanding of how to call and reference another script file in the Shell script. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!