Question fo Intro to Linux class Objective : Create a basic shell script and exe
ID: 3881841 • Letter: Q
Question
Question fo Intro to Linux class
Objective: Create a basic shell script and execute it on the system – using various ways to run it.
Setup: Access your Fedora Workstation VM. Logon as user sysadmin, password netlab123, and open the Konsole terminal.
Requirement: Fill in the blanks below then self-grade the project by answering the questions
1. In the terminal window, type vi myscript
2. Enter the following, starting with the hashpling (also called a shebang): a. #!/bin/bash b. echo -e “This is a sample shell script. It displays disk data on all currently mounted filesystems. ” c. df -h d. Save the file.
3. At the prompt, type ls -l myscript a. What permissions does the myscript file have? _____
4. Type sh myscript a. The shell script will execute. b. What does the escape sequence do? _____ c. What does the escape sequence do? _____
5. Type ./myscript (be sure to type the dot to reference the current directory) a. What error message did you receive? _____ b. Type chmod u+x myscript c. Type ./myscript d. What did Step 5.b. do? _____
Explanation / Answer
3.
ls -l list with long format - show permissions.
we have only read permission not write permissions.
4. means tab sequence.
means new line.
5.
a. here '.' means current directory and '/' means directory within directory . As myscript is my current directory and ther is no other directory inside
caled myscript , we got an error.
b. u stands for user.
That means that chmod u+x somefile will grant only the owner of that file execution permissions .
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.