I’m new to bash and I just want to load a list from a file mentioning that all the lines starting with # or ; should be ignored (and also empty ones).
As expected each valid line should became a string in the list.
I need to perform some action with each (valid) element of this list.
Note: I have a for loop like for host in host1 host2 host3.
You can use bash builtin command
mapfileto read file to an array: