Checking and Modifying PATH of a shell in linux using C coding.
Hi, I'm brand new to linux. I am trying to create a shell using C coding and compiling it on Linux. I looked up on the internet how to check and modify paths via Linux commands on the command prompt:
echo $PATH //to view the paths
PATH = $PATH:[directory] //to add a directory to the path
To my understanding, the path is just a bunch of directories that the program will look into when a program is executed.
How am I to check/modify the PATH using the C programming language?
I'm trying to use an 'execv' function which would run a new program given the path passed in as a parameter.
How would I check the PATH from C? and how would I modify it in C such that when I compile the C code it gives me the shell?
NOTE: This is my first time ever using Linux. I am trying to get my feet wet with it, so please bare with me.