how to use system function to execute the script at at
Fri Jun 22 07:05:54 UTC 2018

hi chris

where is rtems_shell_execute_cmd function defined?

best ben at
From: Chris Johns
Date: 2018-06-22 13:07
To: at; Users
Subject: Re: how to use system function to execute the script
On 22/06/2018 14:44, at wrote:
> hi everyone:
> i want to use the "system()" to execute the script. but do not has output
> first i want to use "system()" to execute the shell cmd, but alse have no output
> the test code is as followed:
>     system("ls -l");
>     system("joel /flash/script/spdloop_1");    //
>  "/flash/script/spdloop_1"----------this is the  script file path in the filesystem 
RTEMS is a single address space, single process OS so you can not exec another
process. You can call the shell command handler from any thread. Make sure you
have enough stack for the thread.
Try something like:
int run_shell_command(const char* cmd)
  #define CMD_MAX_ARGS (20)
  char* cmd_argv = strdup(cmd);
  int   argc;
  char* argv[CMD_MAX_ARGS];
  int   r;
  if (cmd_argv == NULL) {
    fprintf(stderr, "shell: command: no memory: %s", cmd);
    return 1;
  if (rtems_shell_make_args(cmd_argv, &argc, argv, CMD_MAX_ARGS) < 0) {
    fprintf(stderr, "shell: command: arg parse: %s", cmd);
    return 1;
  r = rtems_shell_execute_cmd(argv[0], argc, argv);
  return r;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list