I have been struggling to read information and store it into a .dat file, but everytime I run my bash script it seems to run ok but the .dat file I have made is empty.
Here is my code:
#!/bin/bash
echo "Please enter student's name:"
read student
echo "$student"
((count = 0))
while read students[$count] ; do
((count++))
done < sorted.dat
Am I missing something obvious?
Maybe you have to store student in the file?
#!/bin/bash
echo "Please enter student's name:"
read student
echo "$student" >> sorted.dat
((count = 0))
while read students[$count] ; do
((count++))
done < sorted.dat