Bash (GNU Bourne-again Shell) is a Unix shell written for the GNU program, which is the default shell used by many Linux platforms.
Variables for bash scripting:
1. $BASH
Represents the path of a bash binary program file
Eg: Edit the bash file, such as 1.sh, in which the following code is entered:
Then save the run and the path to the bash script interpreter will appear.
2. $FUNCNAME
Represents the name of the current function
Eg: Edit bash file 2.sh, where you enter the following code:
The results of running the bash file are as follows:
$FUNCNAME acts in the body of a function, the scope of the function is exceeded to become a null value.
3. $IFS
Represents the internal domain delimiter
Eg: Edit bash file 3.sh and enter the following code:
Then save the code to run the following results:
4. $REPLY
When no parameter variable is supplied to the Read command, the variable is supplied to the Read command as a default variable. It can also be used with the Select menu, but only the number of the selected variable, not the value of the variable itself.
Eg: Edit bash file 4.sh and enter the following code:
Save and run to get the following results (the Yellow line part of the content is keyboard input!!!) ):
As you can see from the results, $reply will be supplied to the Read command as the default variable, so the output value of the subsequent $reply is still the value entered when Read!!!
A brief talk on the bash scripting programming variables