0% found this document useful (0 votes)
5 views8 pages

Understanding UNIX Shell Variables

The document discusses UNIX shell environment variables, which are parameters that can be passed to child processes. It explains how to set and view these variables using commands like 'export' and 'env', and highlights the importance of the PATH variable in determining where the shell looks for executables. Additionally, it emphasizes the role of environment variables in sharing information consistently across child processes.

Uploaded by

bendoudouhhind
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Understanding UNIX Shell Variables

The document discusses UNIX shell environment variables, which are parameters that can be passed to child processes. It explains how to set and view these variables using commands like 'export' and 'env', and highlights the importance of the PATH variable in determining where the shell looks for executables. Additionally, it emphasizes the role of environment variables in sharing information consistently across child processes.

Uploaded by

bendoudouhhind
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIX

 Shell  –  Environment  
Variables  
Recap:  
You  will  recall  that  before  we  took  our  side  
trip  to  discuss  the  process  life-­‐cycle  we  were  
talking  about  shell  variables,  also  known  as  
parameters.  
 
We  needed  to  understand  the  process  life-­‐
cycle  to  understand  shell  environment  
variables.  
 
Environment  Variables    
• operate  the  same  as  the  variables  we  have  
seen  
NAME=joe  
echo  ${NAME}  
• AND  they  are  passed  to  child  processes  
• use  the  export  builPn  command  to  ‘set’  
• use  the  env  builPng  command  to  see  what  is  
exported  
Time  for  pictures:  
We  will  now  walkthrough  the  passing  of  
environment  variables  from  parent  to  child.  
Time  for  typing:  
We  will  demonstrate  environment  variables  
from  the  command  line.  
Environment  Variables  -­‐  why  

They  are  a  way  to  pass  instrucPons  to  children.    


Yes  we  can  pass  informaPon  to  children  on  the  
command  line,  but  what  about  informaPon  that  
we  want  to  share  with  all  children  every  Pme?  
 
Like,  where  to  look  for  executables.  
Environment  Variables  -­‐  PATH  
The  PATH  environment  variable  tells  the  shell  
where  to  look  for  executables.  
  echo $PATH!
  PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin!
Time  for  typing  
Let’s  see  how  we  can  change  system  behavior  
by  manipulaPng  PATH.  
 
 

You might also like