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.

  1. 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!.

  2. At the command prompt, type vi myscript and press Enter to open a new file for editing called myscript in your home directory.

  3. 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

  4. 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?

  5. Next, type ./myscript at the command prompt and press Enter. What error message did you receive and why?

  6. 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?

  7. Type exit and press Enter to log out of your shell.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!