I have the following example program:
#include
int
main(int argc, char ** argv){
char buf[100];
printf(\"Please enter your name: \");
Not 100% sure of this (the precise shell being used and the OS might throw these answers a bit; I believe that FreeBSD uses GNU bash
by default as /bin/sh
?), but
sh
may be detecting that its input is not a tty.or
sh
might go into non-interactive mode like that also if called as sh
, expecting login
will prepend a -
onto argv[0]
for it. Setting up execve ("/bin/sh", { "-sh", NULL}, NULL)
might convince it that it's being run as a login shell.