Here's a patch to achieve xterm-compatible behaviour (except for (c)
which doesn't seem important).

Ben.

diff -u gnome-terminal-2.22.3/debian/gnome-terminal.wrapper 
gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
--- gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
+++ gnome-terminal-2.22.3/debian/gnome-terminal.wrapper
@@ -2,6 +2,27 @@
 
 my $login=0;
 
+sub is_cmd_name
+{
+    my $arg = shift;
+    if ($arg =~ /\//) {
+       return -x $arg;
+    } else {
+       for my $dir (split(/:/, $ENV{PATH})) {
+           return 1 if -x "$dir/$arg";
+       }
+       return 0;
+    }
+}
+
+sub user_shell
+{
+    return $ENV{SHELL} if exists($ENV{SHELL});
+    my @pw = getpwuid($<);
+    return $pw[8] if defined($pw[8]);
+    return '/bin/sh';
+}
+
 while ($opt = shift(@ARGV))
 {
     if ($opt eq '-display')
@@ -57,7 +78,11 @@
     }
     elsif ($opt eq '-e')
     {
-       push(@args, '-e', @ARGV);
+       push(@args, '-x');
+       if ($#ARGV == 0 && !is_cmd_name($ARGV[0])) {
+           push(@args, user_shell(), '-c');
+       }
+       push(@args, @ARGV);
        last;
     }
     elsif ($opt eq '-h' || $opt eq '--help')
--- END ---

-- 
Ben Hutchings
Nothing is ever a complete failure; it can always serve as a bad example.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to