comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <jacob@jacob-sparre.dk>
Subject: Re: Trying to execute a command from inside of Ada
Date: Mon, 04 Jun 2018 08:44:10 +0200
Date: 2018-06-04T08:44:10+02:00	[thread overview]
Message-ID: <87a7sboxtx.fsf@jacob-sparre.dk> (raw)
In-Reply-To: 08857a7e-59ae-423e-a683-388df808133d@googlegroups.com

John Smith wrote:

> procedure Sys_Command is
>    Result    : Integer;
>    Arguments : Argument_List :=
>                  (  1=> new String'("bash"),
>                     2=> new String'("ls -l ~")
>                  );

Have you tried to run this on your command line?

   bash "ls -l ~"

That's basically what you ask your program to do.

I would:

1) Avoid involving Bash in this.
2) Remember to pass each argument separately.

And I might additionally:

3) Expand "~" myself, as "ls" doesn't know how to do that (but
   "system()" or "/bin/sh" might).

Greetings,

Jacob
-- 
"Universities are not part of the nation's security organisation,
 they are not the nation's research laboratory either: they are
 the nation's universities."                     -- E.W. Dijkstra

      parent reply	other threads:[~2018-06-04  6:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  3:17 Trying to execute a command from inside of Ada John Smith
2018-06-04  4:42 ` ytomino
2018-06-04  6:44 ` Jacob Sparre Andersen [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox