Summary of using shell scripts
(1) The csh script can call the bash script, and vice versa.
(2). How to call variables and functions defined in other scripts.
(3). Defined variables. The default value is global variables. You must specify local to declare local variables. Column: local value = "Value ",
This variable cannot be called by other functions or files.
(4). Execute load (including)
L example: Call the variables and functions defined in test. sh in use. sh.
Test. sh is defined as follows:
#! /Bin/sh
Function func
{
Echo "the arg is $1"
Value = "$1"
Echo "Value =$ {Value }"
}
Function main
{
Echo "-- main start ---"
Func "test"
Echo "--- main end ---"
}
The following is the definition of main. sh:
#! /Bin/sh
Source./test. sh # (or ../test. sh), you need to specify the path containing the file --- (4)
Echo "--- use start ---"
Main
Echo "call value =$ {Value }"
Echo "--- use end ---"
---------------------
Execute main. sh (or sh-x main. sh)
You can see the call process.