[Gambas-user] how to 'which' with gambas
Rob Kudla
sourceforge-raindog2 at ...94...
Fri Aug 11 22:31:52 CEST 2006
On Fri August 11 2006 16:00, Stefano Palmeri wrote:
> I was talking about a function that do the same job as
> the command line "which". Anyway it is surely
> not a priority... I will continue to play with SHELL "which...
It should be possible to write such a function pretty easily.
Here is some pseudo-code.
function which(exename as string) as string
dim paths as new String[]
dim path as string
dim dirresult as new String[]
paths = Split(Application.Env["PATH"], ":")
for each path in paths
dirresult = dir(path, exename)
if dirresult.count > 0 then
return dirresult[0]
end if
next
return ""
end
'Rob
More information about the User
mailing list