EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: iocsh scripts and not using $PWD
From: Michael Davidsaver via Core-talk <core-talk at aps.anl.gov>
To: EPICS core-talk <core-talk at aps.anl.gov>
Date: Fri, 29 Jan 2021 11:07:56 -0800
I finally got around to executing a small project which has been on my mind
for quite awhile now.  This has the potential to be a high visibility change,
so I want to run it past a wider audience.  (since so few people watch PRs)

Does this seem like a worthwhile change?

https://github.com/epics-base/epics-base/pull/102


The goal is to make it possible to write IOC shell scripts which don't depend
on the current directory.  eg. so that either:

> ./bin/linux-x86_64/myioc iocBoot/iocblah/st.cmd

or

> (cd iocBoot/iocblah && ../../bin/linux-x86_64/myioc st.cmd)

will work.

To do this, the PR adds three new automatic iocsh variables (not environment):
TOP, EPICS_EXEC_DIR, and IOCSH_SCRIPT_DIR.

(Variable names are provisional)

EPICS_EXEC_DIR will be the directory containing the current executable.
TOP will _default_ to "${EPICS_EXEC_DIR}/../..".  TOP set from eg. envPath
will take precedence.

IOCSH_SCRIPT_DIR will be the directory containing the current script file.
I think this could have interesting implications since it takes into
account nested scripts.  So eg. a script fragment containing

> dbLoadRecord("${IOCSH_SCRIPT_DIR}/../../db/blah.db", ...

would load the same .db file if run as

> <myscript.cmd

or

> <somedir/myscript.cmd

or

> <${SOME_MODULE}/db/myscript.cmd

The idea being that modules which have complicated setup could install
self-contained script fragments.  eg. not depending on specific variable
names in RELEASE

Navigate by Date:
Prev: Re: A general question about convert e.g. in longout record drvh, drvl handling Johnson, Andrew N. via Core-talk
Next: Build failed: epics-base base-iocsh-auto-paths-614 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: [Bug 1913699] Re: vxWorks compilation fails with undeclared function Andrew Johnson via Core-talk
Next: Re: iocsh scripts and not using $PWD Ben Franksen via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 03 Jul 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·