Lab 8-2

pdf

School

St. John's University *

*We aren’t endorsed by this school

Course

1163

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

2

Uploaded by SuperHeat2291

Report
CUS 1163 - In-class assignment for shell scripting practice Shell scripting practice questions to be done on Linux server: (1) Check which shell we are using: echo $SHELL (2) Create and run a simple script. Using the nano editor to create a file: nano myscript.sh Sample code: #!/bin/sh echo "Today is: " `date` Change permissions for file chmod 755 myscript.sh Run script ./myscript.sh OR bash myscript.sh (3) Create a script that will input 3 positional (command-line) arguments from the user that indicates a mathematical operation (add, sub, mult, div, mod) and two values, runs the calculation, and displays the result. If the user enters an incorrect operation, an error message should be displayed. Sample interaction could be: ./calc.sh mod 12 10 Result: 2 (4) Write a script that will accept file names as input and your script should only display the files with a .html extension.
(5) Write a script that will accept a file name as input and your script will display the word count and line count for that file. (6) Prove that you worked on the linux server show a screenshot of your work and prove you are logged in to our server use ls on your directory and lastlog | grep your user name Without doing the work on the linux server you will get a 0 for the assignment
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help