---
name: "esystem"
section: "3"
platform: "linux"
package: "libexecs-dev"
version: "1.4-2+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/esystem"
---

# esystem(3)

execute a command with its arguments from a string without using a shell

## NAME

esystem, system\_eexecsp - execute a command with its arguments from a string without using a shell

## SYNOPSIS

**#include \<stdlib.h\>**\
 **#include \<execs.h\>**

**int esystem(const char \****command***);**\
 **int system\_eexecsp(const char \****command***);**

These functions are provided by libexecs and libeexecs. Link with *-lexecs* or *-leexecs*.

## DESCRIPTION

**esystem** is an almost drop in replacement for [**system**(3)](/system/3.md) provided by the libc. **esystem** parses the command string and runs the command directly, without using a shell. (**system\_eexecsp** and **esystem** are synonyms).\
 Command arguments in *args* are delimited by space characters (blank, tabs or new lines). Single or double quotes can be used to delimitate command arguments including spaces and a non quoted backslash (**\\**) is the escape character to protect the next char. The executable file is sought using the PATH environment variable as explained for [**execlp**(3)](/execlp/3.md).\

## RETURN VALUE

These functions have the same return values of [**system**(3)](/system/3.md).

## EXAMPLE

The following program shows the usage of **esystem**:

```
#include <stdio.h>
#include <unistd.h>
#include <execs.h>
#define BUFLEN 1024
int main(int argc, char *argv)
{
	char buf[BUFLEN];
	printf("type in a command and its arguments, e.g. 'ls -l'\n");
	while (fgets(buf, BUFLEN, stdin) != NULL) {
		printf("Command: '%s' \n",buf);
		esystem(buf);
		printf("Command done\n");
	}
}
```

## SEE ALSO

[**system**(3)](/system/3.md),[**execs**(3)](/execs/3.md),**[s2argv(3)](/s2argv/3.md),**[system\_nosh(3)](/system_nosh/3.md)

## BUGS

Bug reports should be addressed to \<info@virtualsquare.org\>

## AUTHOR

Renzo Davoli \<renzo@cs.unibo.it\>
