Reputation: 11
I'm writing my own C Linux shell.
But I have to get and set environment variables.
I've had a little success using getenv("HOME")
in my change directory part.
How do you get and set environment variables in my own shell though?
Upvotes: 1
Views: 400
Reputation: 204
You can use:
int setenv(const char *name, const char *value, int overwrite);
to change the environment belonging to Your current process. All child processes You create will inherit the changed environment.
Upvotes: 1