Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Chapter 8, Lab 2: Shell Parameters and Variables (15 Minutes) Learning Objectives and Outcomes In this lab you will learn about user-created variables and keyword
Chapter 8, Lab 2: Shell Parameters and Variables (15 Minutes) Learning Objectives and Outcomes In this lab you will learn about user-created variables and keyword variables. Reading Read "Parameters and Variables" on page 300 of Sobell up to "Pathname expansion in assignments" on page 303. Procedure Although variables are mostly used in scripts and read by programs, you can experiment with them on the command line. 1. Assign your name to the variable named myname and use echo to display the value of myname when it is unquoted, quoted using double quotation marks, and quoted using single quotation marks. (Refer to "Parameter substitution" in Sobell and "Quoting the \$" (Sobell) 2. Use the readonly (Sobell, page 305) built-in to make the myname variable you created in the previous step a readonly variable and then assign a new value to it. What happens? 3. What is the value of your HOME (Sobell) keyword variable? Demonstrate that the tilde (; Sobell) holds the same value as HOME. List the contents of your home directory using a tilde. 4. The PATH (Sobell) keyword variable specifies the directories in the order bash should search them when it searches for a script or program you run from the command line. What is the value of your PATH variable? 5 . The date (Sobell) utility displays the date and time. Write and execute a shell script that displays the date and time, the name of your home directory, and the value of your PATH variable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started