ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 03 May 2017 My Price 9.00

LINUX LAB 4: BASH SCRIPTING

I don't understand how to use the Linux command prompt and how to create bash scripts in Linux.  I need screenshots of how you completed the assignment and step by step directions with the code you used.

I have attached the assignment.

Due February 12 by 11:30pm

 

LINUX LAB 4: BASH SCRIPTING
Prepared by Jack G. Zheng for IT 4423
This exercise will let you practice Bash shell script basics. INSTRUCTIONS
1. First of all, go through all examples in the lecture notes and the example source files to get familiar with Bash script basics. 2. Write a script to check command arguments (3 arguments maximum). Display the argument one by one. If there is no
argument provided, remind users about the mistake. If there an easy way to use a loop to get all arguments? 3. Practice a simple command line calculator. See the sample output on the right. Use the read command twice to prompt users to enter two integer numbers.
Save them to two variables. Display the sum, difference, and product of these two numbers. - Hint: use
$[ ] to force numeric calculation; example: $[$num1+$num2] 4. Write a script to do a little file count report for a given directory, as shown in the following figure.
a) You may use a command argument to supply the directory you want to report
b) Hint: use ls, grep, wc, regex, and pipe “|”
c) You may see that scripts can help do something that is usually not provided by the OS or any utilities. 5. Write a script to determine if a number is even or odd. 6. Write a script to display numbers from 1 to n, where n is an integer provided by users (if not, default to 10). Hint: use “read”
command to accept user input. 7. Write a script to display the following patterns on the screen. Number of rows and columns are taken from the command
arguments; if they are missing, set default to 3 (rows) and 4 (columns). Hint: you will use a nested loop.
****
****
****
1 8. Create x empty files in a given directory (x is a number), following a naming format like this: myfile1, myfile2, etc. Ask the
user to enter the first part file name and the number of files he/she wants to create. Hint: you may use the “touch”
command to quickly create empty files. Take two screenshots:
a) Display the source code in an editor (#4-1)
b) Execute your script in the terminal, and display the command and the result (#4-2) 9. Write a script to create the following directory structure in a directory of user’s choice. The user can supply the directory of
choice as an argument; if missing, prompt the user to enter one from the command line. Take two screenshots:
a) Display the source code in an editor (#4-3)
b) Execute your script in the terminal, and display the command and the result (#4-4) (User selected existing
directory) Data Image
Cache 10. Edit the script in the prior question.
a) Check if the user input (an existing directory) is valid; if not, ask the user to enter it again.
b) If the “Data” directory exists, then prompt for user actions: cancel or overwrite. Hint: use directory operators; refer to
lecture notes slide #8 and #10. Command line script on one line:
read -p "Enter a number: " max; sum=0; for ((i=1; i<=$max; i++)); do let sum+=i; done; echo "The sum from 1 to $max is $sum" 2

Attachments:

Answers

(11)
Status NEW Posted 03 May 2017 06:05 AM My Price 9.00

-----------

Attachments

file 1493793765-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)