Ответ 1
while read line; do
case "$line" in \#*) continue ;; esac
...
done < /tmp/my/input
Честно говоря, однако, часто яснее обращаться к grep
:
grep -v '^#' < /tmp/myfile | { while read line; ...; done; }
Я перебираю строки в файле. Мне просто нужно пропустить строки, начинающиеся с "#". Как это сделать?
#!/bin/sh
while read line; do
if ["$line doesn't start with #"];then
echo "line";
fi
done < /tmp/myfile
Спасибо за любую помощь!
while read line; do
case "$line" in \#*) continue ;; esac
...
done < /tmp/my/input
Честно говоря, однако, часто яснее обращаться к grep
:
grep -v '^#' < /tmp/myfile | { while read line; ...; done; }