i have bash script where im cycling some command for different lines in external file.
example:
while read domain;do
nslookupout=$(nslookup -type=ns $domain) || true
another commands
done < filenamewithdomains
i added:
|| true
after the command in belief it will just skip failures.
But i got:
nslookup: '.somedomain.com' is not a legal name (empty label)
and it breaken running the script..
please how to achieve so this error is skipped and continuing to the next entry?
i know i can fix my domain list so it dont contains inproper values, but i prefer skipping invalid entries. if anyone know how to remove lines in a file containing two dots at one line by sed, please kindly share.
I don't see, why your code should not work. The || true even takes care of the situation when the shell's -e option is in effect (assuming another command is not failing while -e is in effect).
However, all entries in the filenamewithdomains should not start with a dot.