system_nosh(3)
β¨ system_nosh β¨ (3)
okay bestie, so this is a page from the Linux Programmer's Manual, and it's literally about running commands without a shell. no shell, no problem, we're doing this the direct way π
πΈ 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);
so like, these functions? they're provided by libexecs and libeexecs β you gotta link with -lexecs or -leexecs. no cap, that's the whole vibe check for linking π«Ά
π¦ DESCRIPTION π¦
esystem is almost a drop in replacement for system(3) from the libc. key word: almost. the way it works is, esystem parses that command string and runs the command directly, without ever touching a shell. iconic behaviour honestly π
also psa: system_eexecsp and esystem are synonyms. same function, different name, they're giving twin energy fr fr.
so how does it split up your command arguments? command arguments in args are delimited by space characters β and by that we mean blanks, tabs, or new lines, all of them count π«
and you can quote things! single or double quotes can be used to delimitate command arguments including spaces, and a non quoted backslash (\) is the escape character that protects the next char. so like, backslash is the bodyguard of whatever character comes next π‘οΈ
the executable file gets sought using the PATH environment variable, exactly as explained for execlp(3). so PATH does the finding, you do the vibing π
π RETURN VALUE π
these functions have the same return values as system(3). that's it, that's the section, matching energy only π
π EXAMPLE π
here's a little program showing off 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");
}
}
like?? it literally prompts you, reads your command, runs it, says "Command done". main character loop energy π₯
π SEE ALSO π
(that last one is literally the page you're reading rn, meta moment π)
π BUGS π
found a bug? bug reports should be addressed to <info@virtualsquare.org> β slide into their inbox bestie, they wanna hear it π¬
π§ AUTHOR π§
Renzo Davoli <renzo@cs.unibo.it> β thank you for your service king π«Ά
VirtualSquare, 2014-05-27, and yeah the man page signs itself system_nosh(3) at the bottom, which is very "I contain multitudes" of it β¨ mwah, take care of your processes, drink water, and never use a shell when you don't have to πππ¦
π¦ where this page comes from
- debian bookworm: libexecs-dev 1.3-2 Β· LGPL-2.1-or-later
- debian trixie: libexecs-dev 1.4-2+b2 Β· LGPL-2.1-or-later
- ubuntu jammy: libexecs-dev 1.3-1 Β· LGPL-2.1-or-later
- ubuntu noble: libexecs-dev 1.4-2build1 Β· LGPL-2.1-or-later
- ubuntu questing: libexecs-dev 1.4-2build1
- ubuntu resolute: libexecs-dev 1.4-2build2 Β· LGPL-2.1-or-later
- ubuntu stonking: libexecs-dev 1.4-2build2 Β· LGPL-2.1-or-later
- Copyright (C) 2014 Renzo Davoli. University of Bologna. <renzo@cs.unibo.it>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms