[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How can I find the -c argument?
From: |
Paul D. Smith |
Subject: |
Re: How can I find the -c argument? |
Date: |
Fri, 15 Apr 2005 21:32:34 -0400 |
%% Chet Ramey <chet.ramey@case.edu> writes:
cr> Paul D. Smith wrote:
>> This isn't a bug, actually. I'm wondering if there's any way to
>> access the string provided with the -c option to the shell, from
>> within the shell init files.
cr> The $BASH_EXECUTION_STRING variable exists in bash-3.0 for this
cr> purpose. The $BASH_COMMAND variable may also be used, but that
cr> will probably be overwritten before you can make any use of it.
Ah. But no general Bourne shell way to do it?
Thinking more clearly, what I actually need is a way to access that
string from within _ksh_, not bash. What I'm trying to do is use bash
as my default shell on a system where the only shells they'll let me
have are csh, sh, and ksh. Don't ask.
I can easily set up ksh's .profile to exec bash as my default shell
"normally", but when I log in from a windowing system this environment
will exec my shell as a login shell, passing the commands to be run (the
session manager, ssh-agent, or whatever) via -c. In this case if I try
to re-exec bash I just get logged out again because the command string
given with -c doesn't last through the exec to the invocation of bash.
Currently I'm working around this by checking to see if -c was given
(looking in $-) and if so, I don't do the exec thing. That means I'm
still using ksh here, but I do set SHELL to bash and it seems to mostly
work (my xterms all come out with bash, etc.) Still, I'd like to be
able to re-exec bash if possible.
Cheers!
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist