I want to change the path for the command in a shell. I want to make it easier to type in the command when I run the shell. As of now, I have to type in /bin/ls but I want to just type in "ls" instead. I have altered the function below to do this but it's not working. It still must have the full path. What am I doing wrong? Is it a syntax error?
void get_path_string(char **tmp_envp, char *bin_path)
{
int count = 0;
char *tmp;
while(1) {
tmp = strstr(tmp_envp[count], "LD_LIBRARY_PATH");
if (tmp == NULL)
{
count++;
continue;
}
else
{
break;
}
//tmp = strstr(tmp_envp[count], "PATH");
//if(tmp == NULL) {
// count++;}
// else {
// break;
//}
}
strncpy(bin_path, tmp, strlen(tmp));
}