Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Linux please: Variable Questions Determine and use a command that will store the number 1 2 into the variable num. Write the command in
In Linux please: Variable Questions
Determine and use a command that will store the number into the variable num.
Write the command in your assignment, and explain the importance of the command.
What command will allow you to check the value of the variable num?
Write the command in your assignment.
Start a subshell by typing sh What is the current value for the variable you just created? Why is that so and what can
be done to remedy this? Write down the command, along with your answer as to why the variable did not show in the
subshell.
Executing a Script
For a script file to run in a Linux shell, what permissions must the file have?
Write down the command and options needed in your assignment.
Once a script has the permissions set, what are the three separate ways that would allow you to run that script? Which
way allows you to debug your script?
Scripting Develop scripts using the following problem sets. Be sure to use comments in your scripts. It may be helpful to
first write out the step by step process that you need to solve the problem BEFORE attempting to write the scripts. There
are examples in the PowerPoint lecture. Scripting Develop scripts using the following problem sets. Be sure to use comments in your scripts. It may be helpful to
first write out the step by step process that you need to solve the problem BEFORE attempting to write the scripts. There
are examples in the PowerPoint lecture.
Create a script that asks the user for a file and then appends the date to the file the user has entered. Let the user
know if the file can or cannot be written too. Also, if the file does not exist create the file and write the date in the
newly created file. Lastly display to the user the file, including a statement letting them know that the file has changed.
Hint: remember the and when evaluating a file in an if statement
Create a script that takes two numbers as input from the user, and then asks the user if they would like to add or
subtract the two numbers use a case statement Then print out the result in a friendly message to the screen. Be sure
to let the user know if they choose an option that was not on the menu. Hint: when evaluating the inputted values from
the user, they must be represented as numerical data types. Now modify your case statement so the user can use either
an upper or lower case letter in the menu. That is if the user types a or A both will allow the case statement to run the
add selection. Hint: use as the or operator
How to turn in
After you have completed your lab, submit it here in Canvas
Variable Questions
Determine and use a command that will store the number into the variable num.
Write the command in your assignment, and explain the importance of the command.
What command will allow you to check the value of the variable num?
Write the command in your assignment.
Start a subshell by typing sh What is the current value for the variable you just created? Why is that so and what can be done to remedy this? Write down the command, along with your answer as to why the variable did not show in the subshell.
Executing a Script
For a script file to run in a Linux shell, what permissions must the file have?
Write down the command and options needed in your assignment.
Once a script has the permissions set, what are the three separate ways that would allow you to run that script? Which way allows you to debug your script?
Scripting Develop scripts using the following problem sets. Be sure to use comments in your scripts. It may be helpful to first write out the step by step process that you need to solve the problem BEFORE attempting to write the scripts. There are examples in the PowerPoint lecture.
Create a script that asks the user for a file and then appends the date to the file the user has entered. Let the user know if the file can or cannot be written too. Also, if the file does not exist create the file and write the date in the newly created file. Lastly display to the user the file, including a statement letting them know that the file has changed.
Hint: remember the f and w when evaluating a file in an if statement
Create a script that takes two numbers as input from the user, and then asks the user if they would like to add or subtract the two numbers use a case statement Then print out the result in a friendly message to the screen. Be sure to let the user know if they choose an option that was not on the menu. Hint: when evaluating the inputted values from the user, they must be represented as numerical data types. Now modify your case statement so the user can use either an upper or lower case letter in the menu. That is if the user types a or A both will allow the case statement to run the add selection. Hint: use as the or operator
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