aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-08-31 15:26:34 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-08-31 15:26:34 +0300
commit06138afc98740fe9ae5b76a78e39b07d12b7d38f (patch)
tree8538ac7b169a08f6e289277119c635a72ee4aeb6
parent339bcc9feebd0313a663d1bb361877d425a52157 (diff)
downloadrex-06138afc98740fe9ae5b76a78e39b07d12b7d38f.tar.gz
rex-06138afc98740fe9ae5b76a78e39b07d12b7d38f.tar.bz2
Minor fix in shell mode
-rwxr-xr-xrex.exp16
1 files changed, 13 insertions, 3 deletions
diff --git a/rex.exp b/rex.exp
index 42026f2..312beb7 100755
--- a/rex.exp
+++ b/rex.exp
@@ -1677,7 +1677,10 @@ if {![config_option copy]} {
exit [eval runcprev $config(command)]
}
-if {![info exists config(hosts)] || [llength $config(hosts)] == 0} {
+if {[lindex $config(command) 0] == "shell" && [llength $config(command)] == 2} {
+ lappend config(hosts) [lindex $config(command) 1]
+ set config(option,shell) 1
+} elseif {![info exists config(hosts)] || [llength $config(hosts)] == 0} {
terror "no host list"
listgroups
exit 1
@@ -1710,9 +1713,16 @@ if [config_option copy] {
debug 1 "... in sudo mode"
}
debug 1 "... to $config(hosts)"
-} elseif {[regexp {shell[ \t][ \t]*(.*)} "$config(command)" dummy host]} {
+} elseif [config_option shell] {
global config
- debug 2 "entering shell mode"
+
+ if {[llength $config(hosts)] > 1} {
+ terror "only one hostname is allowed in shell mode"
+ exit 1
+ }
+ set host [lindex $config(hosts) 0]
+
+ debug 2 "entering shell on $host"
set password_sent 0
spawn -noecho ssh [hostuser $host]@$host
expect {

Return to:

Send suggestions and report system problems to the System administrator.