I just fixed the sed call and reworked the resolv.conf generation a little for it to always generate clean resolv.conf
I tried with your ipconfig, some variations of it and mine (including multiple domain/search) and always got the expected result.
I just fixed the sed call and reworked the resolv.conf generation a little for it to always generate clean resolv.conf
I tried with your ipconfig, some variations of it and mine (including multiple domain/search) and always got the expected result.