233k views
5 votes
A simple if statement in Linux. Create a script that will find out whether the user is a full-time student. If the user enters 'y', direct them to go to building J; otherwise, send them to building A.

a) Full-time student goes to building J
b) Full-time student goes to building A
c) Part-time student goes to building J
d) Part-time student goes to building A

User RBS
by
8.5k points

1 Answer

6 votes

Final answer:

To create a script that determines whether the user is a full-time student, you can use an if statement in Linux. If the user enters 'y', they are directed to go to building J; otherwise, they are sent to building A.

Step-by-step explanation:

To create a script that determines whether the user is a full-time student, you can use an if statement in Linux. Here's an example of how to write the script:







Here's an example of the script:



#!/bin/bash

read -p 'Are you a full-time student? (y/n): ' student_status

if [[ $student_status == 'y' ]]
then
echo 'Go to building J'
else
echo 'Go to building A'
fi
User Mark Whitfeld
by
8.6k points