http://ieng6.ucsd.edu/~cs15x/homework/script2/inde…
For more details, please visit https://support.apple.com/kb/HT208050.
jiangzhousima-2:~ jiangzhousima$ ssh cs15lwi21adq@ieng6.ucsd.edu
Password:
Last login: Mon Feb 1 18:21:46 2021 from c-24-5-126-242.hsd1.ca.comcast.net
======= NOTICE ======
Authorized use of this system is limited to password-authenticated
usernames which are issued to individuals and are for the sole use of
the person to whom they are issued.
====
Privacy notice: be aware that computer files, electronic mail and
accounts are not private in an absolute sense. You are responsible
for adhering to the ETS Acceptable Use Policies, which you can review at:
https://blink.ucsd.edu/faculty/instruction/tech-guide/policies/ets-acceptable-u
e-policies.html
==
======
=======
*** Problems, Suggestions, or Feedback ***
For help requests, please create a ticket at:
https://support.ucsd.edu/its
You are using 0% CPU on this system
Cluster Status
Hostname Time #Users Load
ieng6-201 20:00:01 37 1.21,
ieng6-202 20:00:01 39 4.49,
ieng6-203 20:00:01 41 1.21,
Averages
1.47,
1.72
4.52, 4.45
1.33,
1.39
Wed Feb 24, 2021 8:01pm Prepping cs15lwi21
[cs15lwi21adq@ieng6-202]:~:171$ gethw
Assignments:
1 hw1
2 – hw2
3 hw3
4 hw4
5 hw5
6 scripting project 1
7 scripting project 2
8 scripting project 3
–
LO
–
–
Select an assignment by picking a number: 7
Done. Navigate to ‘~/homework/script2’ to get started.
[cs15lwi21adq@ieng6-202]:~:172$ cd homework/script2
[cs15lwi21adq@ieng6-202]:script2:173$ vim parallelograms.sh
[cs15lwi21adq@ieng6-202]:script2:174$
#!/bad/dir/tor/bash
# TODO: Complete the first line with the correct location for bash
#
# Name: TODO
# PID: TODO
# Account ID: TODO
# File: parallelograms.sh
# Assignment: Scripting Project 2
# Date: TODO
#
#:
# DO NOT TOUCH BELOW THIS LINE
#=
ERR_USAGE=”Usage: ./parallelograms.sh”
ERR_INPUT=”Parallelogram size must be [2,20].”
MSG_PROMPT=”Enter the size of the parallelograms to display:
MSG_REPLAY=”Run again? (y/N): ”
U_LIMIT=20
L_LIMIT=2
#=
# DO NOT TOUCH ABOVE THIS LINE
#:
#
# print_pattern
# Function that prints out a parallelogram pattern row by row. The pattern
# should consist of:
#
# [spaces-stars] space [stars-spaces] space [spaces-stars] space [stars]\n
#
# where
# [spaces-stars] is a pattern consisting of spaces and stars up to a given
#
width that will result in a triangle if printed alone
# [stars-spaces] is a pattern consiting of stars and spaces up to a given
#
width that will result in a triangle if printed alone
space
is a single space separating the blocks
# [stars]
is a pattern consisting of only stars for the 4th triangle
# In
is the newline character. Printed with echo
#
# A parallelogram of size three looks like:
#
# ****
* ****
# ** **
#
#
# USAGE
# print_pattern numrows
#
# INPUT
# numrows: number of rows of the parallelogram that should be printed
function print_pattern {
# TODO: Finish this function. You will need nested loops here, as well as
# basic arithmetic. This function should print the parallelograms out row by
# row. Remember that you can do arithmetic expressions with ‘bc’, ‘expr., or
# $(( … )). We’ve provided you with the skeleton code for the first
# triangle. Your job is to finish the rest. Be sure to match the reference
# implementation _exactly_!
*****
* **** *****
# Index to keep track of the current row
ind=0