Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHAPTER 10, LAB 1: PROGRAMMING THE BOURNE AGAIN SHELL (30 MinutES) LeARNing OBJectives AND OUTCOMES READING PROCEDURE The shell copand 50 to the ause of

image text in transcribed
image text in transcribed
CHAPTER 10, LAB 1: PROGRAMMING THE BOURNE AGAIN SHELL (30 MinutES) LeARNing OBJectives AND OUTCOMES READING PROCEDURE The shell copand 50 to the ause of the cilites proprim i50iell, puge 4611. 51-50 munter af genininel puratevers. wript inport as the habe it wat alled an? a variable the atriag the wer tipen in serpenes to the prompt, and there da. propram it uhowal heit Har the Holloi w the nemoeracy file mumed Rexmane wher MD a rhe proces iD mumber (Sobell, page inti) et rhe peocrw ranaing the icripe. Daplay the cuntirnts af the Filiname filr. 5. Write and rai a wert initud loper aheit ian the for (Sobell, puge 4.34) ekh argunem en is arpatati line. freme the siner rask. 7. Write a scrigs anend ithris thar p pongo the merr wuch sa and reads a arring of teve trome the wert If the mer menes a senelf vering, the srije diolays mens the nuow-ay tranch in iter sirge. tile ite inat Chelit, guges 430 and 47 Ts heitin to dectermine it the aner isers a noll atring. What do yeu have so do to avind atting an mrie mesure when yee prompe wirh so? 8. Write and run a simple shell veript named echomyvar that displays the PLD (Sobeli, page 467) of the prosess running the script and value of the variable named myvar. Display the PID of the interactive shcll you are working with. What is the value of the variable within the process running the shell script? Are the interactive shell and the shell ranining the script run by the same or different processes (do they have the same PID)? 5 cat echemyvar echo The P10 of this process is 55 echo The value of myvar ist smyvar 5 eche 55 2651 5 .//echomyvar The PID of this process is 4392 The value of myvar is? The example near the top of Sobell, page 473, demontrates a way to pat a variable is the eavironment of a sript you are calling without declaring the variable in the interactive shell you are running. Use this technique to assign a value to myvar, place it in the environment of echomyvar, and run echomyvar. After tuneing the script, is myvar set in the interactive shell? On the command line, assign a value to the variable named myvar and then run echoenvar again. Which value does the seript display? Use the export (Sohell, page 472) builtin in the interactive shell to place myvar in the environmest and run cchomyvar, ( You can export myvar without assigning a new value to it.) Did the seript display the value of myvar Gurte 10, Las :1 Paogenmming the Boukmt Aadin Smel. 27 this tine? Is the PID of the interactive shell the same or ditferent from the FID of the seript? Call export without an argument and send the output through grep to display the export atribute for myvar. The export builin and dedare x perfom the same function. Use export -a (Sobell, page 473) to usexpont myvar. Show that myvar is a shell variable but is no losger in the environment. Use the unset (Sobeli, page 304 ) builtin to remove myvar. Show that myvar is not available in the interactive shell or in the envieonmeat. DELIVERABLES This lab gives you practice using positional parameters, comments, tempoorary files, and control structures in shell scripts that query the ueer and read information the user enters. It alvo has you work with PDD, the expont builtin, and the environment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions