A Linux Question : Which shell environment variable is used to store your search
ID: 3613155 • Letter: A
Question
A Linux Question : Which shell environment variable is used to store your searchpath ? Change your search path interactively to include thedirectories ~/bin and (.) . What would this change allow you to do? Why? If you want to make it permanent, what would you do? A Linux Question : Which shell environment variable is used to store your searchpath ? Change your search path interactively to include thedirectories ~/bin and (.) . What would this change allow you to do? Why? If you want to make it permanent, what would you do?Explanation / Answer
->”bash” shell variable is used to store searchpath. ->SHELL=/bin/bash This tells where the program thatrepresents your shell is to be found. In case you typed /bin/ksh inthe above, then your bash shell would be replaced with the kshshell (korn shell). So in case you are not happy with the bashshell, you could replace the bash with some other shell. ->HOME defines the home directory for a user. ->PATH defines a list of directories to search through whenlooking for a command to execute.To list the current values of allenvironment variables, issue the command. ->$ envThis would produce a long list. Just go through the list beforereading the next part of the article. Linux by default sets manyenvironment variables for you. You can modify the values of most ofthese variables. ->As in LINUX, the shell uses the PATH variable to locate acommand. PATH contains</!span> a list of dir ectoriesseparated by colons:echo $PATH
/bin:/usr/bin:/usr/local/bin; ->When you enter a command, the shell looks in each of thedirectories specified in PATH to try to find it. If it can't findthe command in any of those directories, you'll see a "Command notfound" message. ->If you decide to put your own programs in a bin directoryunder your home directory, you'll have to change the path toinclude that directory, or the system . ->Now, change your PATH variable so it includes yourpersonal bin directory: PATH=$PATH:$HOME/bin So if PATH was set to</!span>/bin:/usr/bin:/usr/local/bin beforehand, it would nowhave the value</!span>/bin:/usr/bin:/usr/local/bin:/home/hermie/bin. ->Creating Your Own Shell Variables</!span>: -> First issue the command code=$HOME/projects/src/spew and then, regardless of whatdirectory you are in. ->Then issue cd$code.The </!span>cd command means "change directory." ->A variable assignment like this will work just fine, butits scope (visibility) is limited to the current shell. If youlaunch a program or enter another shell, that child task will notknow about your environment variables unless you export them first. ITS HELPFUL TO YOU...... ITS HELPFUL TO YOU......
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.