Question

I need help with this. 1. In a bash shell script, what are the required elements...

I need help with this.

1. In a bash shell script, what are the required elements of an "if" control structure?


2. In a bash shell script, what are the optional elements of an "if" control structure?


3. In a bash shell script, what are the required elements of a "while" control structure?


4. What is the difference between a shell variable and environment variable? Which one is considered local and which is considered global?


5. List the four kinds of shell parameters/variables.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. In a bash shell script, what are the required elements of an "if" control structure?

Answer :

keywords- if,then,fi

Expression : condition with Squre brackets to hold condition or test code

2. In a bash shell script, what are the optional elements of an "if" control structure?

Answer :

else element

3. In a bash shell script, what are the required elements of a "while" control structure?

Answer :

while ,do ,done

Expression : condition or test code enclosed in square brackets

4. What is the difference between a shell variable and environment variable? Which one is considered local and which is considered global?

->Difference between a shell variable and environment variable :

Environment variable : It is inherited in child processes

Shell variable : It is not inherited in child processes

->Which one is considered local and which is considered global?

Local Variable : It is visible and valid within current instance of the shell

Gloabal Variable :It is visible and valid anywhere in bash shell

5. List the four kinds of shell parameters/variables.

Answer :

Local Variable

Environment Variable

Shell Variable

Read-Only variable

Global variable

Unsetting variable

Add a comment
Know the answer?
Add Answer to:
I need help with this. 1. In a bash shell script, what are the required elements...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, I am attempting to write a basic shell script using bash. It will need to...

    Hello, I am attempting to write a basic shell script using bash. It will need to print the user, host, time, and date. It will need to take user input for a txt file to be searched and create a new file to save the results. It must print the number of lines and characters in the text. The user will need to enter three words to be searched, and the number of occurrences of those words in the text...

  • I need this done ASAP. Please write a bash shell script that does the following: Prints...

    I need this done ASAP. Please write a bash shell script that does the following: Prints out how many users are logged on. This can be accomplished using who and wc. Prints out a list of currently logged on users. This can be accomplished using who, grep, regular expressions, and echo. Prints out how many processes you have running from past days, and a list of those jobs. Use `whoami` to get your username. Run ps -ef and see how...

  • Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...

    Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell variables, and .profile script file, echo SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME. Do not give just the value of...

  • UNIX help!!!! I need what the text would look like in the vi editor. also note...

    UNIX help!!!! I need what the text would look like in the vi editor. also note this question has been posted before and the answers were all wrong!! Write a shell script (bash or sh) that prints out the following lines/information: Only your name may be hard coded, the rest must be obtained programmatically within the shell script. Name: "Your name" Hostname: "The computer's hostname" Host IP: "The computer's IP number" Default Gateway: "The computer's default gateway" OS Version: "Whatever...

  • Please write a BASH Script in LINUX that... 1. is actually executable 2. has a comment...

    Please write a BASH Script in LINUX that... 1. is actually executable 2. has a comment to tell us what you did, why and how. 3. allows a user to enter their name and a number between 1 than 100 (this must be prompted so the user knows what to do) 4. creates a random number between 1 and 100 for you to guess. The command to create a random number is shown below. (if you find a better one...use...

  • Please help as much as you can it’s pretty much just terms What is the main purpose of the python-requests module? What kinds of requests can it make, and what types of responses might be returne...

    Please help as much as you can it’s pretty much just terms What is the main purpose of the python-requests module? What kinds of requests can it make, and what types of responses might be returned? Text? HTML? JSON? Images? What is JSON? How does it compare to CSV? Whern processed using the json.loads) method, what Python data structure does the imported JSON get imported as. What is an HTML Document Object Model (DOM) and how does that relate to...

  • Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”....

    Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”. The script reports and prints (to stdout) selected storage management information. Think of it as “RePort Storage Management”. The easy way to describe what the script needs to do is to look at what it should display in the case where you provide incorrect parameters, or in the case where you provide “-h” for help: Usage: ./rpsm.sh <options>< directory> Reports selected information about specified directory...

  • using sql answer the following i need to double check my answers Question 1 Controls the...

    using sql answer the following i need to double check my answers Question 1 Controls the flow of execution based on a condition begin...end try...catch goto if...else 10 points Question 2 Changes the database context to the specified database. set alter exec use 10 points Question 3 Exits the innermost WHILE loop. goto quit return break 10 points Question 4 Controls the flow of execution when an error occurs declare on error goto try...catch continue...error 10 points Question 5 Declares...

  • i need help with this homework webpage and code too: The webpage must include: Global Structure...

    i need help with this homework webpage and code too: The webpage must include: Global Structure Tags Text Tags Images   Your first page must be named index.html Include a table within your site, challenge yourself to add a header in the table, and choose interesting border and/or cell formatting. Include a hyperlink within your site. Include an image in your site. Include a form in your site to demonstrate understanding of a variety of form components (the form does not...

  • i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and...

    i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and Report Search Report host path date Execution time nnn Directories n, nnn, nnn Files nnnnnnn Sym links nnnnnnn Old files nnnnnnn Large files nnnn, nnn Graphics files nnnnnnn Executable files nnnnnnn Temporary files n, nnn, nnn TotalFileSize nnnn, nnn Introduction Lab 7 is nearly identical to Lab 2, except it is written in PowerShell, uses no UNIX/Linux tools to do its work, creates no...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT