You are on page 1of 2

Virginia State University

Reginald F. Lewis College of Business


Computer Information Systems
Operating Systems Administration (CISY 312) Online – Asynchronous

Week4: Shell Expansion

Keynote: DO NOT ignore the recommended TEXTBOOK for this course. Read and ensure that you practice as
instructed in the book.

This is a reading exercise in preparation for Shell Scripting, which is most useful for repetitive tasks that
may be time-consuming to execute by typing one line at a time. But more importantly, at this stage, this is an
introduction to the way commands are processed and changed by the shell before they are executed. There is
nothing technical about this exercise. Just a set of rules or syntax for your note. As an Administrator, you
want to understand:
 the way commands and arguments are processed
 the external and built-in commands
 how to manage environment variables in the shell mainly needed by applications
 how the shell recognizes the patterns and matches in dynamic filename generation (file globbing)

Requirements:
 Week2 Lab completed and knowledge of the Linux commands:
o Directories Operations: pwd, cd, and ls (including absolute and relative paths)
o File Content Operations: cat, head, tail, more, and less
 Basic understanding of how you operate your computing device (hardware and operating system)

Goals:
 Read Chapters 12 – 17. Focus on:
o Commands and Arguments (Ch. 12)
o Shell Variables (Ch. 14)
o File Globbing (Ch. 17)

Tasks (10 Points):


1. Read chapters (12 – 17) and respond to the questions in this week’s exercise.

Deliverable (Evidence of task completed):


Answer the questions and submit your response saved as either a PDF or Word document:
Assign3FirstnameLastname.pdf or Assign3FirstnameLastname.doc.

Reading (Resource to complete tasks):


Linux Fundamentals - Paul Cobbaut (LinuxFun.pdf) – Chapter 12 – 17.

Additional Resource:
 File Globbing (or Dynamic Filename Generation)
Virginia State University
Reginald F. Lewis College of Business
Computer Information Systems
Operating Systems Administration (CISY 312) Online – Asynchronous

Deliverable (Evidence of task completed): Answer the questions and submit your response saved as a PDF or
Word document: Assign3FirstnameLastname.pdf or Assign3FirstnameLastname.doc.

Answer ALL Questions.

1. When in doubt about exactly what the shell is doing with your command. What do you execute to
display shell expansion for every command?
Answer: set -x

2. What are external or built-in commands in Linux? Give two commands for each.
Answer: Pwd, echo

3. By just a command - How can Linux EXPORTED variables be displayed?


Answer: export -p, env

4. What is the value of the HISTFILE environment variable on your Linux VM?
Answer: /home/shills/.bash_history

5. What command to View all environment variables?


Answer: Set

6. Given a variable: myvar gram


Show the command syntecho ax to use the echo and the myvar variable to echo: grammar for histogram
Answer: echo ${myvar}mar forhisto$myvar

7. Execute cd /var and ls in an embedded shell


Answer: echo $(cd /var; ls)

Use the result of the ls command to answer questions 8-10:


omalomo@ubuntuomalomo:~$ ls
file1 file2 file3 File4 File55 FileA fileab Fileab FileAB fileabc

8. Give the result of the shell interpretation of the command:


omalomo@ubuntuomalomo:~$ ls *ileab
Answer: fileab Fileab

9. Give the result of the shell interpretation of the command:


omalomo@ubuntuomalomo:~$ ls ?ile???
Answer: fileabc

10. Give the result of the shell interpretation of the command:


omalomo@ubuntuomalomo:~$ ls File[5a][b5]
Answer: Fileab

You might also like