Fixed tests on systems where bash is not /bin/bash

Some systems, such as BSD, have bash stored in /usr/local/bin

Remove the assumption that bash is /bin/bash

Github issue #60
This commit is contained in:
Duncan Ferguson 2016-04-08 20:46:51 +01:00
parent 754a7137b6
commit 454f30978d
7 changed files with 25 additions and 9 deletions

View file

@ -3,7 +3,7 @@ package App::ClusterSSH;
use 5.008.004;
use warnings;
use strict;
use version; our $VERSION = version->new('4.06');
use version; our $VERSION = version->new('4.07_1');
use Carp qw/cluck :DEFAULT/;

View file

@ -226,7 +226,10 @@ sub expand_glob {
if ( grep {m/[{]/} @items ) {
#@expanded = split / /, `/bin/bash -c 'shopt -s extglob\n echo @items'`;
my $cmd = $self->parent->config->{shell_expansion};
my $shell = $self->config->find_binary(
$self->parent->config->{shell} );
my $cmd
= $shell . q{ } . $self->parent->config->{shell_expansion};
$cmd =~ s/%items%/@items/;
@expanded = split / /, `$cmd`;
chomp(@expanded);

View file

@ -102,7 +102,8 @@ my %default_config = (
send_menu_xml_file => $ENV{HOME} . '/.clusterssh/send_menu',
shell_expansion => "/bin/bash -c 'shopt -s extglob\n echo %items%'",
shell => "bash",
shell_expansion => "-c 'shopt -s extglob\n echo %items%'",
# don't set username here as takes precendence over ssh config
user => '',

View file

@ -573,7 +573,7 @@ would replace the <Alt-n> with the client's name in each window.}
output 'C<< webservers websvr6 websvr7 websvr8 websvr9 >>';
output $self->loc(
q{B<NOTE:> this requires [_1] to be installed on your system (see [_2] configuration option },
'/bin/bash', 'C<shell_expansion>'
'bash', 'C<shell_expansion>'
);
output $self->loc(
q{Extra cluster files may also be specified either as an option on the command line (see [_1]) or in the user's [_2] file (see [_3] configuration option).},
@ -772,8 +772,8 @@ B<NOTE:> Any "generic" change to the method (e.g., specifying the ssh port to us
q{Number of pixels from the screen's side to reserve when calculating screen geometry for tiling. Setting this to something like 50 will help keep cssh from positioning windows over your window manager's menu bar if it draws one at that side of the screen.}
);
output
q{=item shell_expansion = /bin/bash -c 'shopt -s extglob\n echo %items%'"};
output q{=item shell = bash};
output q{=item shell_expansion = -c 'shopt -s extglob\n echo %items%'"};
output $self->loc(
q{Command used to expand a given string (provided by the macro [_1]) - used for expanding host names when a [_2] is in the name. See [_3]},
'C<%items%>', 'C<{>', 'L<bash/EXPANSION>'