Write a script that creates a directory

Assignment Help Software Engineering
Reference no: EM13327259

chp1

1. Write a script that creates a directory calledbpl inside$HOME.Populate this directory with two subdirectories,binand scripts.
2. Write a script to create the "Hello, World!" script,hw, in$HOME/bpl/bin/; make it executable; and then execute it.

chp 2

1.What is wrong with this command?
tr A Z < $HOME/temp > $HOME/temp

2.Write a script, using$RANDOM, to write the following output both to a file and to a variable. The following numbers are only to show the format; your script should produce different numbers:
1988.2365
13798.14178
10081.134
3816.15098

chp 3

1.Write a script that asks the user to enter a number between 20 and 30. If the user enters an invalid number or a non-number, ask again. Repeat until a satisfactory number is entered.

2.Write a script that prompts the user to enter the name of a file. Repeat until the user enters a file that exists.

chp 4

1.How many arguments are there on this command line?
sa $# $(date "+%Y %m %d") John\ Doe
2.What potential problem exists with the following snippet?
year=$( date +%Y )
month=$( date +%m )
day=$( date +%d )
hour=$( date +%H )
minute=$( date +%M )
second=$( date +%S )

chp 5
1.By default, where can a variable assigned in a script be accessed? Select all that apply:
•In the current script
•In functions defined in the current script
•In the script that called the current script
•In scripts called by the current script
•In subshells of the current script
2.I advise against using single-letter variables names but give a couple of places where they are reasonable. Can you think of any other legitimate uses for them?
3.Givenvar=192.168.0.123, write a script that uses parameter expansion to extract the second number,168.

chp 6
1. Rewrite functionisvalidipusing parameter expansion instead of changingIFS.
2. Add a check to_max3to verify that all three arguments are integers.

chp 7
1.What is wrong with this code (besides the inefficiency noted at the beginning of the chapter)?
if ! echo ${PATH} |grep -q /usr/games
PATH=$PATH:/usr/games
fi
2.Write a function calledto_lowerthat does the opposite of theto_upper function in Listing 7-4.
3.Write a function, palindrome, that checks whether its command-line argument is a palindrome (that is, a word or phrase that is spelled the same backward and forward). Note that spaces and punctuation are ignored in the test. Exit successfully if it is a palindrome. Include an option to print a message as well as set the return code.
4.Write two functions,ltrimand rtrim, that trim characters in the same manner astrim but from only one side of the string, left and right, respectively.

chp 8
1. Modify thekjvfirsts script accept a command-line argument that specifies how many chapters are to be printed.
2.Why are the chapter and verse numbers inkjvfirstsformatted with%sinstead of%d?
3. Write anawkscript to find the longest verse in KJV.

chp 9
1.Write a script that stores the time it takes a command (your choice of command) to run in three variables,real, user, andsystem, corresponding to the three default times that timeprints.

chp 10
1.What is wrong withif [ $var=x ]? What should it be? Why does it give the result it does?
2.Write a function, valid_square(), that returns successfully if its sole argument is a valid SAN chessboard square or fails if it is not. Write a function to test that it works.

chp 11
1.Modify themenufunction to accept its parameters from a file.
2.Rewrite thepr1function asprxthat will behave in the manner ofpr4from
Chapter 8 but will take an option for any number of columns.
3.Add agetoptssection to thefifteengame that allows the user to select between three different board formats. Write a third format.

chp 12
1.Add code to theupload script that checks that all variables have been set to legitimate values (for example, thatportis an integer).
2.Write ausageorhelp function, and add it to theuploadscript.
3.Add an option to theuploadscript to save the configuration if it has been saved.
4.Write a script that creates a configuration file in the same form aswords.cfg, prompting the user for the information to put in it.

chp 13
1.Modify theisortandasearchfunctions to usesortandgrep, respectively, if the array exceeds a certain size.
2.Write a function that transposes rows and columns in a grid (either a single-string grid or an array). For example, transform this:
123
456
789
into this:
147
256
369
3.Convert some of the grid functions, either string or array versions, to work with grids that are not square, for example, 6×3.
4.Convert the code that parses fixed-width records into a function that accepts the line of data as the first argument, followed by thevarname=width list.

chp 14
1.Write a function,hbar, that accepts two integer arguments, a width and a color, and prints a bar of that color and width. Write a second function,hbar_at, that accepts four arguments, row, column, width and color; moves the cursor to the row and column; and passes the remaining arguments tohbar.
2.White a function,clear_area, that accepts two integer arguments, rows and columns, and clears a rectangular area of that many rows and columns.

chp 15.
1.Using thekey-funcslibrary, write a menu script that uses the function keys for selection.
2.Rewrite thekey-funcslibrary to include mouse handling, and incorporate the function into the mouse-demo script.
3.Thepasswordscript does minimal checking for invalid entries. What checking would you add?
How would you code it?

Reference no: EM13327259

Questions Cloud

What is the fixed charge coverage : (a) What is the times-interest-earned ratio - Times-interest earned If the firm's lease payments are $43,700, what is the fixed charge coverage?
What is the velocity of the hovercraft : An initially stationary hovercraft sits on a large lake. At time t=0 it accelerates due north at a rate of 1.2 m/s2 for 10 s, what is the velocity of the hovercraft at time t=40 s
Determine what should happen to the supply of money : if there are no excess reserves in the banking system and $1 billion in new reserves are created by the federal reserve, what should happen to the supply of money
Introducing a new line of executive desks : Custom Office Furniture is introducing a new line of executive desks made from a specially selected grade of walnut. Initially, three models- A, B, and C- are to be marketed
Write a script that creates a directory : Write a script that asks the user to enter a number between 20 and 30. If the user enters an invalid number or a non-number, ask again. Repeat until a satisfactory number is entered.
Balance sheet for the bryan corporation : The balance sheet for the Bryan Corporation is shown below. Sales for the year were $3,680,000, with 75 percent of sales sold on credit and income statement for J. Lo Wedding Gowns, compute the following ratios:
Describe difference in economic profit in firm nd monopolist : describe the difference in economic profit between a competitive firm and a monopolist in both the short and long run. Which should take longer to reach long-run equilibrium.
Calculate the present value of annuity : Calculate the present value of this annuity at an annual effective interest rate of 8%.
Predict one major change in the us financial environment : Predict one major change in the U.S. financial environment that may likely occur within the next five years, indicating its impact to the economy and businesses.

Reviews

Write a Review

Software Engineering Questions & Answers

  What would you consider some of the key considerations

Explain your choices. Is the organization you work for (or one that you are familiar with) meeting these key considerations?

  Aspects of software development

Unit testing is the driving technology behind a software design method termed Test Driven Development, which, in turn, is a factor of the agile school of software development.

  Describe your chosen architecture pattern

Include charts or diagrams created in Visio or an equivalent such as Dia. The completed diagrams / charts must be imported into the Word document before the paper is submitted.

  Tentative list of requirements for proposed system

Create a tentative list of requirements for the proposed system. possible solution that could meet the business requirements and provide a short description and indicate participating actors and role Context diagram, DFD.

  Find the difference between text enclosed

When the shell is reading the command line what is the difference between text enclosed between double quotes (") and text enclosed between single quotes (')? Consider two cases.

  Draw er diagram to situation implied in student assistant

Draw an ER diagram (with a reasonable number of attributes) to represent the situation implied in the student assistant scenario of the previous question.

  Develop erd by entities-attributes for driver-s log document

Use Microsoft Access to develop a preliminary (no keys and no relationships) database tables for Huffman Trucking Driver Log.

  Creating well documented object oriented application

Construct an efficient, well-documented object oriented application to manage all of job offers that an upcoming graduate is getting.

  Bank customer withdrawing money from an atm

Describe (in a one to two (1-2) page narrative) a use case, complete with typical and alternate courses, that documents the event of a bank customer withdrawing money from an ATM.

  End users must be involved in database design in a limit

End users must be involved in database design, but only to  degree. What are you are your toughts do you agree or did agree why or why not.

  Calculate the error in the sense of least square

Calculate the error in the sense of least square when using the three models with the values.

  Program that calculates and displays the amount of money

Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd