I think at this point I should sort-of start over.
Here is user1's actual .bash_profile:
-----bash.1[~]: cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
# put one pair of xeyes in the upper right corner of the left monitor,
# and one pair of xeyes in the upper left corner of the right monitor.
/usr/bin/xeyes -geometry 1000x150+1559+0 -fg black -center pink -outline black &
/usr/bin/xeyes -geometry 1000x150+2560+0 -fg white -center black -outline red &
# the end.
bash.2[~]:
-----
Here is user2's actual .bash_profile:
-----
-bash.1[~]: cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
# put one pair of xeyes in the upper right corner of the left monitor,
# and one pair of xeyes in the upper left corner of the right monitor.
/usr/bin/xeyes -geometry 300x300+2259+0 -fg black -center pink -outline black &
/usr/bin/xeyes -geometry 300x300+2560+0 -fg white -center black -outline red &
# the end.
-bash.2[~]:
-----
(yes, the xeyes options are different from those of user1)
A. When, from the login screen, I log in as user1, the xeyes show up as they should.
B. When, from the login screen, I log in as user2, the xeyes show up as they should.
C. (3 steps)
1. From the login screen, I log in as user1; the xeyes show up as they should.
2. I launch a terminal.
3. In that user1 terminal, I enter "su --login user2", and then enter the
password. xeyes show up the same as in B above. That happens to be directly on top of
the xeyes launched in step 1.
I do not want any change in A and B; they should continue just as they are. But I want
C.3 to *not* launch new xeyes at all, since the xeyes launched in step 1 are still there
and functioning as they should.
I'm trying to achieve this in the .bash_profile scripts by putting the launches of the
xeyes in a bash if-block. Example...
-----
if ! [[ "pgrep xeyes > /dev/null" ]] ; then
xeyes [etc]
xeyes [etc]
fi
-----
But so far, everything I've tried for the test in the if line has failed. What should
I put in the if line's [[ ]]? While waiting for replies, I'll start experimenting
with "pidof" as suggested by Patrick and Ed, and what Todd suggested in his most
recent post.
side comment/request:
Last month, I changed the e-mail address associated with my Fedora users list account from
a yahoo address to a comcast address. For this post, I used HYPERKITTY to reply to my
original post. If this shows up in HYPERKITTY but *not* in your e-mail, please let the
list know.