forked from andonome/lk
		
	write eval
This commit is contained in:
		
							
								
								
									
										22
									
								
								basics/eval.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								basics/eval.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| --- | ||||
| title: "eval" | ||||
| tags: [ "basics" ] | ||||
| --- | ||||
|  | ||||
| Compose a statement for execution. | ||||
|  | ||||
| ```bash | ||||
| x='echo $y' | ||||
| echo $x | ||||
| y=dragon | ||||
| eval "$x" | ||||
| ``` | ||||
|  | ||||
| The results remain in the current shell, unlike sub-shells. | ||||
|  | ||||
| ```bash | ||||
| b=basilisk | ||||
| sh -c 'echo $b' | ||||
| eval "g=goblin" | ||||
| echo $g | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user