#!/bin/bash
while read p
do
echo "$p"
done < numbers.txt
This script is only reading and allowing me to print .sh files. I have tried it with .txt files (like above but it does not print anything.)
#!/bin/bash
while read p
do
echo "$p"
done < numbers.txt
This script is only reading and allowing me to print .sh files. I have tried it with .txt files (like above but it does not print anything.)
That's because you are printing test not variable p
Try this:
#!/bin/bash
while read p
do
echo "$p"
done < numbers.txt
Test:
$ cat numbers.txt
1
2
345
678
9
$ bash script.sh
1
2
345
678
9
$