Question: Project 7-1. In this hands-on project, you use the shell to redirect the stdout and stderr to a file and take stdin from a file.
Project 7-1. In this hands-on project, you use the shell to redirect the stdout and stderr to a file and take stdin from a file. At the command prompt, type tr o O /hosts and press Enter. What happened and why? At the command prompt, type tr o O <
Project 7-1.
In this hands-on project, you use the shell to redirect the stdout and stderr to a file and take stdin from a file.
At the command prompt, type tr o O and press Enter. What happened and why?
At the command prompt, type tr o O <
Type exit and press Enter to log out of your shell.
Project 7-2.
In this hands-on project, you redirect stdout and stdin using pipe metacharacters.
At the command prompt, type cat /etc/services | grep NFS | tr F f | sort r | sed /udp/d | sed /tcp/s/mount/MOUNT/g and press Enter. Explain the output on the terminal screen. Can this output be obtained with the grep and tr commands instead of sed? At the command prompt, type cat /etc/hosts . Next, type cat /etc/hosts | awk /localhost/ {print $1, $3} and press Enter. Explain the output on the terminal screen. Type exit and press Enter to log out of your shell.
Project 7-3. In this hands-on project, you create and use an alias, as well as view and change existing shell variables. In addition to this, you export user-defined variables and load variables automatically upon shell startup.
At the command prompt, type alias asample="cd /etc ; cat hosts ; cd ~ ; ls F" and press Enter. What does this command do?
At the command prompt, type asample and press Enter. What happened and why? What environment file could you add this alias to such that it is executed each time a new BASH shell is created? Type exit and press Enter to log out of your shell.
Project 7-4. In this hands-on project, you create a basic shell script and execute it on the system.
Next, type ./myscript at the command prompt and press Enter. What error message did you receive and why?
At the command prompt, type chmod u+x myscript and press Enter. Next, type ./myscript at the command prompt and press Enter. Did the script execute? Why?
Project 7-5. In this hands-on project, you create a shell script that uses decision and loop constructs to analyze user input.
At the command prompt, type chmod u+x familydatabase.sh and press Enter. Next, type ./familydatabase.sh at the command prompt and press Enter. Type a and press Enter when prompted and supply the appropriate values for a family member of your choice. Does the menu continue to appear when you have finished entering your record? Type a and press Enter and supply the appropriate values for a different family member. Type s and press Enter and supply a piece of information you previously entered for a family member to see the results. Type x and press Enter to view the usage error. Finally, type q and press Enter to quit your shell script.
In this hands-on project, you create a local Git repository for the shell scripts that you created in Project 7-5, and explore Git version control.
At the command prompt, type cd ~/shellscripts and press Enter to switch your cloned repo in your home directory. Next, type git pull origin master and press Enter to pull a new copy of the master branch from your original repo. Was the pull successful? Type exit and press Enter to log out of your shell.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
