I am writing a configuration script in some custom lang and I want it to do it's job using the resources given in the same directory as the script, but I am not sure of how to get a the path where the executable is located in FreeBSD.
The there is some guides () for getting it from
Note that
By the way is
The there is some guides () for getting it from
procfs
, but I want one that does not require Linux compatibility Layers like procfs
the FreeBSD Quickstart Guide for Linux users shows the existence of sysctl
as the FreeBSD way to do things, but executing sysctl -a | grep -i path
does not give anythings that looks like the current executable path, nor trying sysctl -a | grep -i /bin/sh
.Note that
argv[0]
is not preferable option, as there is not even a guarantee that the argument may have anything to do with the file path, rather than the absolute path.By the way is
procfs
part of any UNIX specification?