It’s not. You keep insisting that ^D doesn’t send EOF and yet:
$ stty -a | grep eof
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
$ man stty |grep -A1 eof |head -n2
eof CHAR
CHAR will send an end of file (terminate the input)
^D (which is an ASCII EOT character) signals EOF. The thing is that in C every line of a text file must be terminated by a new-line. And so, when you end a file with ^D without a return, you get funky results.
Sure, though I advise against it. The following C program can do that:
As seen in:
This will allow anyone in group
sudo
to execute any command as root. You may change the group to something else to control who exactly can run the program (you cannot change the user of the program).If there’s some specific command you want to run, it’s better to hard-code it or configure
sudo
to allow execution of that command without password.