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 theterminal using the user name of root and the password of LNXrocks!.2. At the command prompt, type vi myscript and press Enter to open a new file forediting called myscript in your home directory.3. Enter the following text into the myscript file. When finished, save and quit the vi editor.#!/bin/bashecho –e “This is a sample shell script. \t It displays mountedfilesystems \a”mount4. At the command prompt, type ls -l myscript and press Enter. What permissionsdoes the myscript file have? Next, type bash myscript at the command prompt andpress 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 messagedid 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.

LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
5th Edition
ISBN:9781337569798
Author:ECKERT
Publisher:ECKERT
Chapter7: Working With The Bash Shell
Section: Chapter Questions
Problem 4HOP
icon
Related questions
Question

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 LNXrocks!.
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”
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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L