bash:files:read_a_file:skip_reading_comments
Differences
This shows you the differences between two versions of the page.
bash:files:read_a_file:skip_reading_comments [2021/01/26 13:41] – created peter | bash:files:read_a_file:skip_reading_comments [2021/01/26 13:42] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== 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: | ||
+ | |||
+ | <code bash> | ||
+ | while read -r line; do | ||
+ | [[ $line = \#* ]] && continue | ||
+ | printf ' | ||
+ | done < " | ||
+ | </ | ||
+ | |||
+ | ---- | ||
bash/files/read_a_file/skip_reading_comments.1611668488.txt.gz · Last modified: 2021/01/26 13:41 by peter