User Tools

Site Tools


en:cs:bash:variable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:cs:bash:variable [2025/04/26 12:38] – created ulascemhen:cs:bash:variable [2025/04/26 12:40] (current) ulascemh
Line 3: Line 3:
 ===== Local Variables ===== ===== Local Variables =====
  
-```bash+<code bash>
 foo=one foo=one
    
Line 21: Line 21:
 # This will print ''one'' to the console. # This will print ''one'' to the console.
 echo $foo echo $foo
-```+</code>
  
 ===== Environment Variables ===== ===== Environment Variables =====
Line 27: Line 27:
 One feature we will use for Scope is the system that exists in all Unix systems. For example, when we call a program in a script, all environment variables are copied into the scope of that program. In short, the variables we define in the called script can only be accessed if they are environment variables. One feature we will use for Scope is the system that exists in all Unix systems. For example, when we call a program in a script, all environment variables are copied into the scope of that program. In short, the variables we define in the called script can only be accessed if they are environment variables.
  
-```bash+<code bash>
 # create a new variable and set it: # create a new variable and set it:
 # -> This is a normal variable, not an environment variable! # -> This is a normal variable, not an environment variable!
Line 34: Line 34:
 # Let's make it visible to all sub-processes by converting it to an environment variable: # Let's make it visible to all sub-processes by converting it to an environment variable:
 export test_variable export test_variable
-```+</code>
  
 <wrap onlyprint>Taken from [[en:cs:bash:variable|UCH Wiki]].</wrap> <wrap onlyprint>Taken from [[en:cs:bash:variable|UCH Wiki]].</wrap>
en/cs/bash/variable.txt · Last modified: 2025/04/26 12:40 by ulascemh