[Method 1]
read -p "Please enter your file name: " file
cat $file | while read line
do
echo "Line ${line[$i]}"
#印出file內的所有欄位
done
read -p "Please enter your file name: " file
cat $file | while read line
do
echo "Line ${line[$i]}"
#印出file內的所有欄位
done
[Method 2]
read -p "file name: " file_name
while read line
do
echo "${line}"
done < $file_name
read -p "file name: " file_name
while read line
do
echo "${line}"
done < $file_name