====== 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" ----