What is the most commonly used file extension for a shell script? answer .ksh .zsh .bash .sh
Added by Amy J.
Step 1
A shell script is a text file that contains a sequence of commands for a Unix-based operating system's shell to execute. Show more…
Show all steps
Your feedback will help us improve your experience
Supreeta N and 58 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
2) (20 points) Write a Bash shell script named "calc.sh" that a. Performs addition (+), subtraction (-), multiplication (x), and integer division (/) math operations. b. Takes in 2 operands and 1 operator and prints the result. Example: "calc.sh 5 + 3" would print "8" and "calc.sh 9 / 2" would print "4" c. If there are not exactly 3 arguments, or the second argument is not one of the operators in part (a), or first or third argument is not an integer, print an error message and exit d. If operator is division (/) and second operand is 0, then print error message "error: cannot divide by 0" and exit e. Hint: Use case statement
Supreeta N.
Use BASH to create a simple script programming which manipulates, manages, and analyzes some files and their content under a Linux environment. Therefore, the BASH program must have at least two main functions, which cover two major components: 1) the file access and 2) the file content manipulation and analysis. The average length for a single-person project is about 20 – 40 lines. Any additional group member will expect to increase the effective length by about 50%. E.g., two students' groups should have about 30 – 60 lines. Effective length means the code used for the functions is necessary and sufficient. A non-effective length sample is a code with 20 lines of echo to print out many messages. The grading will be based on the outcome of the functions, success or failure, complex level, and efficiency of the codes. For multiple students' projects, the grades are individual, which means if one does not contribute equally, this group member can have a much lower grade compared to the same group members if they submit a confident contribution breakdown to me. Some samples of one student's project ideas: Check a series of files in a folder and pick the ones that match the user input. Create a new file that merges all the contents in the selected files. Look up a targeted file (the report fails if there is no such file). Count the total number of words used in the targeted file / replace a word given by the user, etc. Look up a file with numbers and provide a statistic report on how many numbers are greater than the threshold value given by the user.
Akash M.
For this assignment, you are going to create a script that prints "Hello world" to the PowerShell window. It is recommended that you watch all the lectures in the Module 7 section to complete this assignment. In your Windows VM: 1. In your documents folder, create a folder called "Scripts". 2. Create a plain text file called Helloworld.txt. 3. In the plain text file, write your code to print the string "Hello world". 4. Save the file and rename the file extension from .txt to .ps1. 5. Start PowerShell and run the cmdlet [Start-transcript]. 6. Navigate to the Script folder in PowerShell. 7. Select and run your Helloworld.ps1 script. 8. You should see "Hello world" printed to the PowerShell window. 9. Run the cmdlet [Stop-transcript].
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD