EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: if-then-else in iocsh
From: Andrew Johnson <[email protected]>
To: Emmanuel Mayssat <[email protected]>
Cc: [email protected]
Date: Fri, 28 Jan 2005 13:32:08 -0600
Emmanuel Mayssat wrote:

I would like to check for the settings of an environment variable in iocsh. If the envrionment variable is not set, then I want to set it to a default value. Is there any way to do that ?

Yes, but how depends what variables you're trying to set, and whether this is for a particular IOC or all IOCs using a particular version of EPICS Base. The ioc shell is not intended to be a programming language, and it doesn't (and never will) provide conditional commands, so you can't just put something in the startup script that will work for any environment variable.


If you're trying to set site-specific defaults for some of the standard EPICS environment variables, the way to do that is to edit them into your <base>/configure/CONFIG_SITE_ENV file (or even the CONFIG_ENV file if these are Channel Access settings). Once you've changed those files you'll have to rebuild base and all the IOC applications that use it.

If the variables you're trying to set are not EPICS variables at all, or you don't want to set them for all systems using that installation of EPICS base, you'll have to write your own iocsh command in C - either to do all the work you want with the variable name(s) and value(s) burned into the code, or just write a command that takes a variable name and default setting you want which will set it if there's no current value.

There is another alternative to writing C code if the IOC is running on a workstation or PC - write a shell-script wrapper around your IOC executable which does the environment variable setting before executing the real IOC program.

HTH,

- Andrew
--
Dear God, I didn't think orange went with purple until I saw
the sunset you made last night.  That was really cool. - Caro

Replies:
Re: if-then-else in iocsh Maren Purves
References:
if-then-else in iocsh Emmanuel Mayssat

Navigate by Date:
Prev: if-then-else in iocsh Emmanuel Mayssat
Next: Re: if-then-else in iocsh Maren Purves
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: if-then-else in iocsh Emmanuel Mayssat
Next: Re: if-then-else in iocsh Maren Purves
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024