Argonne National Laboratory

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  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 
<== Date ==> <== Thread ==>

Subject: Re: ENVVAR.right_trim in IOC console
From: "Jemian, Pete R. via Tech-talk" <tech-talk@aps.anl.gov>
To: Till Straumann <strauman@slac.stanford.edu>, EPICS Tech Talk <tech-talk@aps.anl.gov>
Date: Mon, 30 Sep 2019 04:26:33 +0000
Thanks for the feedback.  I agree this type of editing is beyond the 
current design.  I'm looking at the luash recently added as a possibility.

Pete

On 2019-09-29 10:35 PM, Till Straumann wrote:
> It would probably be easy to wrap std:: or boost:: regex_replace() into
> a iocsh call with, e.g., 'sed'-like syntax so that you could say
> 
> epicsEnvSetSubstituted( "IOCNAME", "/(^.*)(.$)/\1/", "$(PREFIX)" )
> 
> that would give you a quite powerful tool...
> 
> HTH
> - Till
> 
> 
> 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?
>>
>> 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)")
>>
> 

-- 
----------------------------------------------------------
Pete R. Jemian, Ph.D.                 <jemian@anl.gov>
Beam line Controls and Data Acquisition (BC, aka BCDA)
Advanced Photon Source,    Argonne National Laboratory
Argonne, IL  60439                    630 - 252 - 3189
-----------------------------------------------------------
       Education is the one thing for which people
          are willing to pay yet not receive.
-----------------------------------------------------------



References:
ENVVAR.right_trim in IOC console Jemian, Pete R. via Tech-talk
Re: ENVVAR.right_trim in IOC console Till Straumann via Tech-talk

Navigate by Date:
Prev: Re: ENVVAR.right_trim in IOC console Till Straumann via Tech-talk
Next: RE: error binding socket Alfio Rizzo 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 
Navigate by Thread:
Prev: Re: ENVVAR.right_trim in IOC console Till Straumann via Tech-talk
Next: write a CA client by API in Eclipse 肖麟阁 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 
ANJ, 30 Sep 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·