On 22/06/16 16:32, Marc-Antoine Vincent wrote:
Greetings to All,

I am writing a custom script where for convenience I store modbus register names/index in /etc/environment. It seems that my machinekit does not recognize /etc/environment variables while executing my custom M177 bash script.

I think this is entirely the wrong place to store variables.

Even if you want environment variables and not a file which contains the values, /etc/environment is a poor choice because it does not support variable expansion.

I am also unsure as to whether anything placed into it, is available until after a reboot, or at least a log out and log in again.

I would suggest that if you must have env vars, just write the values to a file as
echo "export FOO=bar" >> myvars

Then either make it executable and execute the myvars file at the start of a session or include it into your .bashrc environment using
. ./myvars

IMHO writing to a file and interrogating that directly would be a much better overall solution.

You could even save them to the .ini file (or a file which it includes) and use those values in your .hal file by using the [SECTION]VARIABLE_NAME convention, but that might just be a complication too far, compared to just reading a var file.

regards


--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to