Answer:
First, create the parttolerance.dat file with the line in the question. This can easily be done by using the echo command from the command line:
echo 123 44.205 44.287 >> parttolerance.dat
Then write a simple script file that prompts the user for the weight and then compares that input to the values within the file created above. If the value of the weight is within the range, then print the value is within range. Otherwise print it is not within range.
Step-by-step explanation:
// create the parttolerance.dat file
echo 123 44.205 44.287 >> parttolerance.dat
Shell script
#!/bin/bash echo
"Enter the part weight: "
read input_weight
IFS=' ' while IFS=' '
read -r col1 col2 col3 do
part_number="$col1"
file_weight_lower="$col2"
file_weight_upper="$col3"
done <parttolerance.dat
if (( $(bc <<< "$input_weight >= $file_weight_lower && $input_weight <= $file_weight_upper") > 0 )); then
echo "The part $part_number is within range"
else
echo "The part $part_number is not in range"
fi
run script:
./parttol.sh