Problem

In this hands-on project, you create a basic shell script and execute it on the system....

In this hands-on project, you create a basic shell script and execute it on the system.

1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of secret.

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 myscript2 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"

mount

4. At the command prompt, type ls -l myscript and press Enter. What permissions does the myscript file have? Next, type bash myscript at the command 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

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 7