Function Description: Recalculate the parameter content.
Grammar: Eval [parameter]
Additional instructions: Eval can read a series of parameters and then execute them according to the characteristics of the parameters.
Parameter: Parameters are not
1. 12 steps of bash command processing;
1. Divide command lines into tokens separated by fixed metacharacters;
SPACE, TAB, NEWLINE, ; , (, ),, |,&
The types of tokens include words, keywords, I/O redirections, and semicolons.2. Check the first mark
One, Bash command processing of 12 steps; 1. Divide the command line into tokens delimited by the fixed element character set; SPACE, TAB, NEWLINE, ; , (, ),, |,& Token types include words, keywords, I/o redirects, and semicolons.2. Check the first
Due to work needs, it took some time to study the two built-in special commands of eval and exec. Because not many are used, it is a bit obscure ..
1. Eval
This command is a built-in command in bashshell, which is a little more difficult than other
1.1 Shell parsing command lineThe approximate operation of the shell when reading and executing commands is as follows:Take the following command as an example:Echo " Some files: " " \nthe date:$ (date +%f) \n$name ' s is $ ((a+4) ) "
This article explains what the process of a Linux command is going through when it executes. And the approximate sequence of these processes.1.1 Shell parsing command lineThe approximate operation of the shell when reading and executing commands is
Eval
Eval performs a two-pass scan of the following commands, executes this command if the command is a normal command after the first scan, and guarantees the semantics of the indirect reference if the command contains an indirect reference to the
EvalEnter the value in the string.
Syntax: void eval (string code_str );Return Value: NoneFunction Type: Data Processing
Description
This function can be used to substitute variable values in a string for processing database data. The code_str
The difference and relation between the inverted quotation mark "" "and the $ ()' $ ' (parameter substitution) and ' ' (Command substitution)The use of the anti-quote "'" and $ () is the same. When executing a command, the statement in the ", or $ ()
The role of Eval is to perform command-line processing again, that is, to perform two command-line processing on a single command line.1. Example 1: Using the eval technique to implement the shell's control structure forUse the Eval technique to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.