so i am new to Linux and our instructor gave us this assignment, its fairly simple but I haven't been able to create a unique column for my 'employee code' (we need this in order to avoid duplicating codes) I tried two methods below
Method 1
echo "Enter an Employee Code:
read code
if [$code uniq -u]
then
echo "Enter surname"
read surname
echo "Enter Other names"
read other_names
echo "Choose Gender"
echo "f Female m male"
read gender
case $gender in
f) Female;;
m) Male;;
*) echo" that was not one of the choices"
esac
echo " Enter DOB"
read dob
echo "Enter Phone Number"
read phone_num
echo "$code $surname $other_names $gender $dob" >> details
else echo "Duplicate employee code" fi
METHOD 2
echo "Enter an Employee Code:
read code
while [ $code -ne $code ]
do
echo "Enter surname"
read surname
echo "Enter Other names"
read other_names
echo "Choose Gender"
echo "f Female m male"
read gender
case $gender in
f) Female;;
m) Male;;
*) echo" that was not one of the choices"
esac
echo " Enter DOB"
read dob
echo "Enter Phone Number"
read phone_num
echo "$code $surname $other_names $gender $dob" >> details
else echo "Duplicate employee code"
done
can someone please help? method 1 doesn't recognize the "uniq" constraint while method 2 keeps increments non-stop. thanks a lot in advance :)