From the bash man page:
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.
According to the first response when googling "scp bashrc" this behavior changed with bash 2.02 when they added code to attempt to detect if ssh shells were interactive or not, and set the "interactivity" accordingly. Thus, testing $PS1 or $- may or may not work properly. Unfortunately, I don't have time to test it thoroughly at the moment. Let us know how it turns out.
Aaron J.
Brian A. Henning wrote:
Ah, yes, that definitely seems to be it exactly.. Any output from a bashrc appears to confuse scp.. Apparently it closes the connection after it sees a line-feed character in the stdout stream. Not being a wisened programmer, I can only speculate as to why it was coded that way.
At any rate, I do not wish to forfeit the output of my ~/.bashrc if I can avoid it. Is there any sort of condition I could check to conditionally branch around the output only when scp is making the connection? Like some environment variable or perhaps the parent process that spawns the instance of bash? Something akin to this pseudo-shellcode:
if [remote_command ne "scp"]; then /usr/local/games/fortune; /usr/bin/uptime; fi
Thanks everyone that offered suggestions.
Cheers, ~Brian
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of bp Sent: Monday, April 05, 2004 8:51 AM To: Triangle Linux Users Group discussion list Subject: Re: [TriLUG] SCP acting funny
On Sun, 4 Apr 2004, James Manning wrote:
Could it be the output from /etc/bashrc is somehow confusing the
process?
Maybe - as a quick sanity check I'd rename the relevant .bashrc / .profile files (any of them that get run at ssh/scp time, checking access times should help if you're unsure) so they're not run at all during scp.
On RedHat 9 I too noticed this horrible behaviour; any output coming from bashrc (welcome to host xyz) caused scp to connect and immediately disconnect with no file being transfered. Get rid of the output and the issue will be fixed. This was the case on several of my lab boxes recently. -bp
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
-- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
