* Trying to run ls, pwd, rm, etc. in linux without specifying the exact path
@ 2016-03-09 17:05 John Smith
2016-03-09 17:55 ` Simon Wright
0 siblings, 1 reply; 2+ messages in thread
From: John Smith @ 2016-03-09 17:05 UTC (permalink / raw)
Hello,
I found this little example and expanded on it:
http://rosettacode.org/wiki/Execute_a_system_command#Ada
I used the example where GNAT.OS_Lib is used. Everything works like I want it to, almost. If I want to call a Linux command, I have to specify the exact path to it /bin/ls. How can I import the various Linux environment variables so tha I can just call 'ls' without specifying the direct path to the binary?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Trying to run ls, pwd, rm, etc. in linux without specifying the exact path
2016-03-09 17:05 Trying to run ls, pwd, rm, etc. in linux without specifying the exact path John Smith
@ 2016-03-09 17:55 ` Simon Wright
0 siblings, 0 replies; 2+ messages in thread
From: Simon Wright @ 2016-03-09 17:55 UTC (permalink / raw)
John Smith <yoursurrogategod@gmail.com> writes:
> I found this little example and expanded on it:
> http://rosettacode.org/wiki/Execute_a_system_command#Ada
>
> I used the example where GNAT.OS_Lib is used. Everything works like I
> want it to, almost. If I want to call a Linux command, I have to
> specify the exact path to it /bin/ls. How can I import the various
> Linux environment variables so tha I can just call 'ls' without
> specifying the direct path to the binary?
I think Locate_Exec_On_Path ("ls") should do the trick.
-- Try to locate an executable whose name is given by Exec_Name in the
-- directories listed in the environment Path. If the Exec_Name does not
-- have the executable suffix, it will be appended before the search.
-- Otherwise works like Locate_Regular_File below. If the executable is
-- not found, null is returned.
--
-- Note that this function allocates memory for the returned value. This
-- memory needs to be deallocated after use.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-09 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 17:05 Trying to run ls, pwd, rm, etc. in linux without specifying the exact path John Smith
2016-03-09 17:55 ` Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox