Question: Linux please help Project 7-4 In this hands-on project, you create a basic shell script and execute it on the system. Switch to a command-line
Linux please help
Project 7-4
In this hands-on project, you create a basic shell script and execute it on the system.
-
Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal using the user name of root and the password of LINUXrocks!.
-
At the command prompt, type vi myscript and press Enter to open a new file for editing called myscript in your home directory.
-
Enter the following text into the myscript file. When finished, save and quit the vi editor.
#!/bin/bash echo e "This is a sample shell script. \t It displays mounted filesystems: \a" df -hT
-
At the command prompt, type ls -l myscript and press Enter. What permissionsdoesthemyscriptfilehave?Next,typebash myscriptatthecommand prompt and press Enter. Did the shell script execute? What do the \t and \a escape sequences do?
-
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?
-
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
