Question
(LINUX) LAB 1 Log on and open a terminal window. and confirm that you're running bash with the ps command. Run the command that gives
(LINUX) LAB 1
Log on and open a terminal window. and confirm that you're running bash with the ps command.
Run the command that gives you a list of all the environment variables that are currently set.
Using a pipe to the wc command, find out how many environment variables are currently set.
Create a new environment variable called MYVAR and set its value to "myvalue". Use the command export MYVAR to allow MYVAR to be used by sub-programs of the shell. Verify that this step worked by printing out the value of MYVAR on the terminal. Also repeat step 3 to ensure that the number of variables increased by 1.
Try changing your command prompt to:
"prompt> "
nothing
your username
the output of the date command followed by "$ " (tricky)
Write shell program called hello to print hello, world on the screen. Try running this program from your home directory by typing hello at the prompt. This won't work; you need to use the absolute path to run the program - try this now. Now change the environment variable called PATH so that you can run hello without an absolute path from anywhere.
Print the value of the environment variable called HOSTNAME. If it's not currently set, set its value to be the name of the machine you're working on (without using that exact name in the command you type). Verify that HOSTNAME was set correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started