Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
This is an ancient question, and is answered multipletimeselsewhere. It also smells suspiciously like homework...
Short version: variables are evaluated (i.e. env for the child process is constructed) before the command-line is executed, unless they are protected by single quotes. This applies also to builtins like echo.
LinuxOS wrote: ↑2023-11-28 02:39it works properly when I use sh -c?
There's nothing "improper" about the first result, it's expected (though arguably somewhat confusing) behaviour. You'll find shells other than bash do this as well.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.