Re: interactive and login shells: bug or design decision ?
From: Greg Wooledge (wooledg_at_eeg.ccf.org)
Date: Thu, 24 Mar 2005 07:54:46 -0500 To: Cristian Zoicas <email@example.com>
On Wed, Mar 23, 2005 at 05:07:58PM +0100, Cristian Zoicas wrote:
> When ssh is started interactively, it starts a login shell, but when it is
> started in batch mode (e.g. ssh firstname.lastname@example.org command) it runs my
> command under an interactive shell.
It doesn't do that for me. From man bash:
An interactive shell is one started without non-option arguments and
without the -c option whose standard input and output are both con-
nected to terminals (as determined by isatty(3)), or one started with
the -i option. PS1 is set and $- includes i if bash is interactive,
allowing a shell script or a startup file to test this state.
And on my system:
imadev:~$ ssh localhost 'echo $-'
imadev:~$ ssh localhost 'echo $PS1'
(That's a blank line after the password prompt.)
> The ssh version that I use is OpenSSH_3.6.1p2
OpenSSH 3.9p1 for me, on HP-UX 10.20, with bash 2.05b.