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

#!/bin/bash echo -n \"Enter a string: \" read st if [ $st = \"CS ] then echo $st

ID: 3631716 • Letter: #

Question

#!/bin/bash

echo -n "Enter a string: "
read st
if [ $st = "CS ]
then
echo $st
else
echo "IT"
fi

n=5

if [ $n < 0 ]
then
echo -n "Solution 1:"
echo $n
fi

if [ $n == 5 ]
then
echo -n "Solution 2:"
echo $n
fi

n++
echo -n "Solution 3:"
echo $n

echo I don't care

name = "John"

if [$name = "John"] then
echo "Hi John"
fi

if [ grep $name /etc/passwd ] then
echo $name has an account at 'hostname'
else
echo $name doesn't have an account at 'hostname'
fi

Explanation / Answer

Check this working fine fix all the errors #!/bin/bash echo -n "Enter a string: " read st if [ $st = "CS" ] then echo $st else echo "IT" fi n=5 if [ $n -lt 0 ] then echo -n "Solution 1:" echo $n fi if [ $n == 5 ] then echo -n "Solution 2:" echo $n fi n=$((n + 1)) echo -n "Solution 3:" echo $n echo "I don't care" name="John" if [ $name = "John" ]; then echo "Hi John" fi grep $name /etc/passwd > /dev/null if [ $? ]; then echo "$name has an account at `hostname`" else echo "$name doesn't have an account at `hostname`" fi