If statements
In Linux just like with most scripting languages you can use if statements to allow for step-by-step processing through a set of rules. Let’s say you wanted to have a simple script to handle clock-ins for you employees:
#!/bin/sh echo "Enter your employee ID:" read employeeID echo "in - Clock in" echo "out - Clock out" read clockStatus if [ $clockStatus = "in" ] then date >> $employeeID"_timeclock" echo "$employeeID logged in" >> $employeeID"_timeclock" else date >> $employeeID"_timeclock" echo "$employeeID logged out" >> $employeeID"_timeclock" fi |