Experimental Physics and Industrial Control System
|
I was starting to come to the same
conclusion: That there was something fundamentally wrong in some
basic assumption I was making that I didn't even know I was making
it.
The culprit turned out to be the sudo command.
Experimenting with the various nested scripts we use to launch the
IOC shell, I found that, indeed, setting the IOCSH_PS1 value in
any one of them worked just fine, so it had to be something about
how I was launching the outermost one, since it was completely
ignoring the value I set in my login shell.
The problem turned out to be that I was launching the scripts
using sudo, and the default behavior for sudo is to NOT execute
commands using your existing environment. This make sense from a
security standpoint, but I had somehow never run in to the issue
before or given it any thought. To pass my test the way I was
doing it, all I needed was to use the -E option on the sudo
command.
Of course, that was only for testing. For normal use, I will have
one of the scripts set the value. But at least now I know about
this (perfectly sensible) behavior and (hopefully) won't bang my
head on that particular wall again.
I never know what new tidbit I am going to learn when I launch in
to one of these "quick" projects (I mean, really, all I wanted to
do was change the shell prompt! How hard could THAT be?
ARRrrgggghhhhhh!)
Anyway, thanks for your help, and in helping to get me pointed in
the right direction.
Mark Davis
On 2/27/2014 11:25 AM, Eric Norum wrote:
You’re trying this on linux?
I just tried:
makeBaseApp.pl -t example example
makeBaseApp.pl -t example -i
example
../../bin/linux-x86_64/example
st.cmd
export IOCSH_PS1=“FOO
BAR> "
../../bin/linux-x86_64/example
st.cmd
and got
. . .
## Start any sequence programs
#seq sncExample, "user=enorumHost"
FOO
BAR>
I didn’t type anything fancy on the export line — just
a <return>.
I then added this line to the startup script:
epicsEnvSet IOCSH_PS1 "$(PROMPT)"
export PROMPT="ONE LINER> "
../../bin/linux-x86_64/example st.cmd
.
. .
## Start any sequence programs
#seq sncExample, "user=enorumHost"
ONE LINER>
export PROMPT="TWO
> LINER> "
../../bin/linux-x86_64/example
st.cmd
. . .
## Start any sequence programs
#seq sncExample, "user=enorumHost"
TWO
LINER>
The fact that you get a complaint about PROMPT being
undefined makes me think that there’s something weird with your
linux shell — that it’s not actually passing on the environment
properly.
Don't know why it
doesn't work for for me.
I tried this first just using the name IOCSH_PS1
for my bash environment variable, which didn't
work.
Figuring that the IOCSH_PS1 value might get some
special treatment, or that something in the
scripts we use to lauch the IOC shell are doing
something of their own, I tried this:
___________________________________________
In my bash shell, before launching the IOC shell:
davis-pc:/home/epics/R3.14.12.2/apps/mdlinux/iocBoot/iocFrib>
export PROMPT=$'\nmdlinux> '
OR
davis-pc:/home/epics/R3.14.12.2/apps/mdlinux/iocBoot/iocFrib>
export PROMPT=" <--- typed Ctl+V, Ctl+J
mdlinux> "
___________________________________________
Both of which produce the same effect:
davis-pc:/home/epics/R3.14.12.2/apps/mdlinux/iocBoot/iocFrib>
env
...
PROMPT=
mdlinux>
...
OR
davis-pc:/home/epics/R3.14.12.2/apps/mdlinux/iocBoot/iocFrib>
set | grep PROMPT
PROMPT=$'\nmdlinux> '
___________________________________________
In the st.cmd file:
epicsEnvSet("IOCSH_PS1", "$(PROMPT)")
which produces the error:
macLib: macro PROMPT is undefined (expanding
string epicsEnvSet("IOCSH_PS1", "$(PROMPT)"))
and I also tried:
epicsEnvSet IOCSH_PS1 $(PROMPT)
which produces the error:
macLib: macro PROMPT is undefined (expanding
string epicsEnvSet IOCSH_PS1 $(PROMPT))
___________________________________________
Is there something special you have to do to get a
particular bash environment variable to show up in
the EPICS IOC shell? If not, what determines
which ones show up and which ones don't?
Mark Davis
|
- References:
- newline in IOCSH_PS1 value Mark Davis
- Re: newline in IOCSH_PS1 value Eric Norum
- Re: newline in IOCSH_PS1 value Mark Davis
- Re: newline in IOCSH_PS1 value Eric Norum
- Re: newline in IOCSH_PS1 value Eric Norum
- Navigate by Date:
- Prev:
Re: newline in IOCSH_PS1 value Andrew Johnson
- Next:
Autosave an array field (not record) Zhang, Dehong
- 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:
Re: newline in IOCSH_PS1 value Eric Norum
- Next:
RE: newline in IOCSH_PS1 value Mark Rivers
- 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
|
ANJ, 17 Dec 2015 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|