I have the following command ping -qc 1 $(idn2 .) in a bash script file ping.sh.When I run the script as $ bash -x ./ping.sh I get:++ idn2 c.+ ping -qc 1 xn--c-7sbgbnrw0abkzd2k.xn--p1aiping: unknown host xn--c-7sbgbnrw0abkzd2k.xn--p1ai+ exitwith idn2 result of xn--c-7sbgbnrw0abkzd2k.xn--p1aiBut when I type the command $ ping -qc 1 $(idn2 .) in my terminal bash command line, I get another result:PING xn--80aealotwbjpid2k.xn--p1ai (95.173.135.62) 56(84) bytes of data.--- xn--80aealotwbjpid2k.xn--p1ai ping statistics ---1 packets transmitted, 0 received, 100% packet loss, time 0mswith idn2 result of xn--80aealotwbjpid2k.xn--p1ai.What's this?
idn2 works differently from bash script and command line
dns;ping
In short, make sure you type international domain names with the right keyboard layout, and do not fix international domain names spelling with a wrong keyboard layout.I have rewritten . string in my script by hand, than I tested the script and the problem is gone. I was lucky that I have added the script in a git repo. So I git diff, and git shown me that there was a diff in .. Then I git difftool with vimdiff set up as difftool and realized that I had ASCII c letter in . instead of russian c. That was the problem.