How can I avoid running .bashrc?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
How can I avoid running .bashrc when I specify a command to be executed
*AND* use the -t option because the command needs tty semantics?

What I'd really prefer is to directly execute the command WITHOUT running
it through the shell at all.  I know that would mean either something else
has to parse the command string into tokens, or the command has to be
provided already broken into tokens.  But I guess that means extending
the SSH protocol so it can transfer the command as separated tokens instead
of a single string.

But for some reason, using -t triggers running the shell in interactive
mode as opposed to command mode.  Is ssh/sshd doing that or is the shell
detecting this and making an assumption?

If there was at least some environment variable set going into the shell
that would indicate a command is being provided on the command line, then
I could at least code the .bashrc to skip everything if that environment
variable is set.  But I did some tests and see nothing distinctive between
these cases.

| Phil Howard KA9WGN (  /  Do not send to the address below |
| first name lower case at   / |

Re: How can I avoid running .bashrc? writes:

Quoted text here. Click to load it

Change the command so it does not require tty semantics.

Quoted text here. Click to load it

Or the command has to be written so that it does not need interpreting at

Quoted text here. Click to load it

Re: How can I avoid running .bashrc? schrieb:
Quoted text here. Click to load it

in the book "Adv. Programming in the Unix environment" second edition,
on page 694 a program pty is described (source code), with can be used
to connect a programm to a pty, i.e. fake a terminal to the command.
The chapter clearifys a lot of pty/tty miracles to me.

Maybe the same can be achieved by use of expect or tee, or just using
pipes for in/output, depends on the command. E.g. if it is passwd on
Solaris, it expect to have a stderr for the prompt "password:". Linux
seems to can use passwd without pty/tty.

Quoted text here. Click to load it

putty has an option for setting the terminal type, so there must be a
protocol specification for transfer the terminal (i thing telnet has
something to do that) and i wonder if putty does that manually. So save
the TERM, setting it to something special, which depends on your
programm and if it use termcap/termlib (in that case you must use a real
term definition, but you can import your own name and minimal termcap).

SSH 2 has the possibility to pass env, see the configuration parameters
in openssh:
SendEnv (ssh_config)
AcceptEnv (sshd_config)
also it must not be disallowed in the authorized_keys file.


Site Timeline