EPICS Home

Experimental Physics and Industrial Control System


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

Subject: Re: ENVVAR.right_trim in IOC console
From: Michael Davidsaver via Tech-talk <[email protected]>
To: "Jemian, Pete R." <[email protected]>, EPICS Tech Talk <[email protected]>
Date: Sun, 29 Sep 2019 20:25:20 -0700
On 9/29/19 6:35 PM, Jemian, Pete R. via Tech-talk wrote:
> 
> Working in the IOC shell (EPICS base 7.0.3), how to remove the last 
> character from an EPICS environment variable?

I don't think there is any way to do this at present.
The IOC shell isn't a fully featured shell/programming language.


> given this definition:   epicsEnvSet(PREFIX, "xxx:")
> I want to achieve this result: "xxx" by somehow editing $(PREFIX) in place.
> 
> In bash, this is possible using ${PREFIX::-1} but in the IOC shell:
> 
> iocxxx> echo $(PREFIX::-1)
> macLib: macro PREFIX::-1 is undefined (expanding string echo $(PREFIX::-1))
> 
> 
> The context is I want to change this line from:
> 
> dbLoadRecords("some.db","IOCNAME=$(PREFIX)")
> 
> to:
> 
> dbLoadRecords("some.db","IOCNAME=$(PREFIX - 1 character)")

I think you'll have to resort to doing this the other way around.

epicsEnvSet("IOCNAME", "blah")
epicsEnvSet("PREFIX", "$(IOCNAME):")

Replies:
Re: ENVVAR.right_trim in IOC console Eric Norum via Tech-talk
References:
ENVVAR.right_trim in IOC console Jemian, Pete R. via Tech-talk

Navigate by Date:
Prev: ENVVAR.right_trim in IOC console Jemian, Pete R. via Tech-talk
Next: Re: ENVVAR.right_trim in IOC console Eric Norum via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: ENVVAR.right_trim in IOC console Jemian, Pete R. via Tech-talk
Next: Re: ENVVAR.right_trim in IOC console Eric Norum via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024