User Tools

Site Tools


bash:files:read_a_file:skip_reading_comments

BASH - Files - Read a file - Skip Reading Comments

To avoid reading comments starting with hash, #, simply skip them inside the loop:

while read -r line; do
  [[ $line = \#* ]] && continue
  printf '%s\n' "$line"
done < "$file"

bash/files/read_a_file/skip_reading_comments.txt · Last modified: 2021/01/26 13:42 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki