RE: SSH wont execute commands with bash



You might try adding the -t argument to your ssh call.

-----Original Message-----
From: listbounce@xxxxxxxxxxxxxxxxx [mailto:listbounce@xxxxxxxxxxxxxxxxx] On Behalf Of Tonnerre Lombard
Sent: Wednesday, November 15, 2006 10:31 AM
To: davej
Cc: secureshell@xxxxxxxxxxxxxxxxx
Subject: Re: SSH wont execute commands with bash

Salut,

On Tue, 2006-11-14 at 05:02 -0800, davej wrote:
------------------------------------
if [ -e /usr/bin/bash ]
exec /usr/bin/bash
exit
fi
------------------------------------

Two notes here:

1. you're not passing on any arguments. These lines should look rather like this:

if [ -e /usr/bin/bash ]
then
exec /usr/bin/bash "$@"
fi

2. exec already overwrites the process so exit is only going to be reached in case of error, in which it might be better to return an error or whatever:

if [ -e /usr/bin/bash ]
then
exec /usr/bin/bash "$@"
ret=$?
echo "Failed to execute bash: ${ret}"
exit ${ret}
fi

Tonnerre
--
SyGroup GmbH
Tonnerre Lombard

Lösungen mit System
Tel:+41 61 333 80 33 Röschenzerstrasse 9
Fax:+41 61 383 14 67 4153 Reinach BL
Web:www.sygroup.ch tonnerre.lombard@xxxxxxxxxx



Relevant Pages

  • Re: [freebsd-questions] Dangers of using a non-base shell
    ... The effect is that you only have to type exit once, ... I was going to suggest exec, but if bash then failed to execute, you'd be ... My suggestion would execute bash if it ...
    (freebsd-questions)
  • Re: Ruby and science ?
    ... Ruby's exec isn't a POSIX exec when running on Windows. ... How about "JRuby by default does not assume the user wants POSIX-style ... In an effort to be more constructive, I present the two bugs in question: ... JRuby does not do a hard process exit on calls to Kernel#exit because ...
    (comp.lang.ruby)
  • Re: TRUE is 0 is FALSE
    ... the if statement is testing the exit status of the function, ... While 1 is considered true in boolean logic, ... bash if statements. ... It's about whether that means that true has the value zero, or if it's simply what's stated throughout the bulk of the shell documentation - that "if" operates on exit statuses and takes the "then" leg given a zero/success exit status. ...
    (comp.unix.shell)
  • Re: Why dont threads get killed in this case?
    ... -bash-3.2$ ps waux | grep djdoboy ... -bash-3.2$ exit ... % shopt huponexit ...
    (comp.lang.ruby)
  • Re: =?iso-8859-1?Q?V=E1?= =?iso-8859-1?Q?=3A?= Using wdm how to pass "-- 
    ... you've told your X session to exit immediately. ... .xsession is a bash script. ... "exec FOO" causes the shell to run FOO and exit ...
    (Debian-User)