# exec Family: execle

```c
/* Exec/execle.c */
#include <stdio.h>
#include <unistd.h>
int main(int argc,char *argv[])
{ 
    char *env[] = {"LS_COLORS=fi=04;33;44",NULL}; 
    printf("Using *execle* to exec ls -l\n"); 
    execle("/bin/ls","ls","-l","--color",NULL,env); 
    printf("Program Terminated\n");
    return 0;
}
```

`execle()` uses *pathname*, *argument list* and *provided ENV* to execute the program.

```c
execle("/bin/ls","ls","-l","--color",NULL,env);
```

You need to provide the exact location (pathname) in order to execute it.

For the arguments, they are specified directly in the `execle()` function.

You can define new environment variables in the function. The environment variables are in a `char*` array. In this example, the behavior of `ls` can be changed by the variables. In this case, the colors for displaying files and directories are changed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eric-lo.gitbook.io/lab4-process/process-execution/execle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
