Skip to main content

Posts

Showing posts with the label environment variables

Shell vs Environment vs Persistent Variables

Variables   One of the first things that we need to cover is how to deal with variables. They were briefly talked about in the other chapters, but they will be cover in slightly more depth here. The variable functionality provides a way for the script to get input, store data temporarily, and display output to the user or sending data to a calling script. There are two categories that variables can be divided into:   Environment Variables: are maintained by the system, they are inherited by the current and any child shells or processes that are spawned.   Shell Variables: are contained exclusively within the shell in which they were set or defined. They are mostly used to keep track of temporal data, like the current working directory in a session.   Shell Variables   There are generally two types of shell variables. Those that are maintained by the system, and the others that are user defined for scripts or passing information into other commands, scripts or programs. As s