How about the following using the "<" to read another file:
# other ioc commands go here
epicsEnvSet MY_ENV A
< mychildscript.cmd
epicsEnvSet MY_ENV B
< mychildscript.cmd
# more ioc commands go here
Mark
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Angus Gratton
Sent: Tuesday, October 12, 2010 6:20 PM
To: tech-talk
Subject: Calling an iocsh "sub-script"
Is it possible to call subscripts from a parent iocsh script? ie
# other ioc commands go here
epicsEnvSet MY_ENV A
iocsh mychildscript.cmd
epicsEnvSet MY_ENV B
iocsh mychildscript.cmd
# more ioc commands go here
This seems like it should be possible, but the app dev guide has left me
drawing a blank. The "iocsh <script>" command that's available in
VxWorks would do it, but it isn't available on RTEMS.
I was thinking of writing a thin wrapper around the C function iocsh()
and exporting that, but that seems like it might not work if it is not
available now.
Particularly, I'm keen to do is pass the parent environment context to
the child. Is that possible?
***
Explanation: The reason that I want to do this is that I have two banks
of Group 3 DI interfaces that are both configured identically on
separate loops, ie my .cmd initialisation code has:
initGP3TypeD L1D0B1, L1, 0, 1
initGP3TypeD L1D0B2, L1, 0, 2
initGP3TypeD L1D0B3, L1, 0, 3
initGP3TypeD L2D0B1, L2, 0, 1
initGP3TypeD L2D0B2, L2, 0, 2
initGP3TypeD L2D0B3, L2, 0, 3
(for around 15 init statements each)
and I'd like to be able to do:
initGP3TypeD ${LOOP}D0B1, ${LOOP}, 0, 1
initGP3TypeD ${LOOP}D0B2, ${LOOP}, 0, 2
initGP3TypeD ${LOOP}D0B3, ${LOOP}, 0, 3
... and then call that script file twice with environment variable
LOOP=L1 and LOOP=L2, to save on copy-paste.
- Angus
- Replies:
- RE: Calling an iocsh "sub-script" Angus Gratton
- Re: Calling an iocsh "sub-script" Josh Stein
- Re: Calling an iocsh "sub-script" emmanuel_mayssat
- References:
- Calling an iocsh "sub-script" Angus Gratton
- Navigate by Date:
- Prev:
Calling an iocsh "sub-script" Angus Gratton
- Next:
RE: Calling an iocsh "sub-script" Angus Gratton
- 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
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Calling an iocsh "sub-script" Angus Gratton
- Next:
RE: Calling an iocsh "sub-script" Angus Gratton
- 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
2019
2020
2021
2022
2023
2024
|