Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One of your coworkers needs help with a script that he has been working on but c

ID: 3865956 • Letter: O

Question

One of your coworkers needs help with a script that he has been working on but cannot seem to get working. He has copied his bad script, superscript.sh, into your home directory under the scripts directory (~/scripts/superscript.sh). After correcting the script, build a simple script of your own to assist in retrieving user info from SLASH/etc/passwd and SLASH/etc/group to make user administration simpler.

#! /bin/slash

@superscript.sh

echo -e “ SuperScript 9000 ”

echo “This script will print the TPS report for 02-14-2016 ”

cat ./SLASH/reports/current/tps-report-02142016.txt

echo -e “ Thank you! ”

A. Correct the Script: Correct your coworker's script, make the script executable (owner and group, not world), execute the corrected script, take a screenshot of the entire script code, take a screenshot of the executed script output, and describe each correction you made to the script to get it working and explain why you made those changes. • Description of each correction made to the script and why:

Explanation / Answer

T

Scripts can also be run with arguments; as explained in Rute (p. 68): myfile.sh dogs cats birds will output The first argument is: dogs, second argument is: cats, third argument is: birds because the content of this script after the shebang is: echo "The first argument is: $1, second argument is: $2, third argument is: $3"

To execute a script in another directory, use ~/Scripts/dogs.sh

Binaries