I'm looping over lines in a file. I just need to skip lines that start with "#". How do I do that?
#!/bin/sh
while read line; do
if ["$line doesn't start with #"];then
echo "line";
fi
done < /tmp/myfile
Thanks for any help!
I'm looping over lines in a file. I just need to skip lines that start with "#". How do I do that?
#!/bin/sh
while read line; do
if ["$line doesn't start with #"];then
echo "line";
fi
done < /tmp/myfile
Thanks for any help!
while read line; do
case "$line" in \#*) continue ;; esac
...
done < /tmp/my/input
Frankly, however, it is often clearer to turn to grep
:
grep -v '^#' < /tmp/myfile | { while read line; ...; done; }