How do I execute a Shell built-in command with a C function?

If you just want to execute the shell command in your c program, you could use, #include <stdlib.h> int system(const char *command); In your case, system(“pwd”); The issue is that there isn’t an executable file called “pwd” and I’m unable to execute “echo $PWD”, since echo is also a built-in command with no executable to … Read more

shell init issue when click tab, what’s wrong with getcwd?

This usually occurs when your current directory does not exist anymore. Most likely, from another terminal you remove that directory (from within a script or whatever). To get rid of this, in case your current directory was recreated in the meantime, just cd to another (existing) directory and then cd back; the simplest would be: … Read more