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

Create a shell script that returns a full name associated with a userid specied

ID: 3666664 • Letter: C

Question

Create a shell script that returns a full name associated with a userid specied in the command line argument.
• Use the names found in /acct/common/CSCE215-Spring16.
• Your shell script should be named “ndName.sh”
– Example usage: $ ./findName.sh seiei SETSUNA F SEIEI $ – Your shell script must either: Return the full name associated with the userid or Return an error message if the command line arguments are not equal to 1. or Return the message “Sorry that person is not in CSCE215 this semester” No other output is acceptable

Explanation / Answer

#!/bin/sh
# cmdarg.sh -
# for use by csce215 students.
# for use , in some project.....

if [ $# -eq 1 ]; then
# if there is exactly one command line arg used with the command
# do something(s).


echo < " $1" > test
if [ -s ./test ]; then
cat test
else
echo "You should not see this line as output....."
fi
else

# tell the user how to use the command and exit the script
echo "usage: `basename $0` [only_one_argument]"



# userID does not match any student in that section
echo "Sorry that student is not in CSCE2215-801"
exit1
fi

#!/bin/sh
# cmdarg.sh -
# for use by csce215 students.
# for use , in some project.....

if [ $# -eq 1 ]; then
# if there is exactly one command line arg used with the command
# do something(s).


echo < " $1" > test
if [ -s ./test ]; then
cat test
else
echo "You should not see this line as output....."
fi
else

# tell the user how to use the command and exit the script
echo "usage: `basename $0` [only_one_argument]"



# userID does not match any student in that section
echo "Sorry that student is not in CSCE2215-801"
exit1
fi

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote