gnome-terminal with --command option fails after first time

Bug #157266 reported by Jesse Aldridge
34
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GNOME Terminal
Confirmed
Wishlist
gnome-terminal (Ubuntu)
Triaged
Low
Ubuntu Desktop Bugs

Bug Description

Binary package hint: gnome-terminal

Open the terminal ( Accessories -> Terminal )

> gnome-terminal --command "echo test"

Close the spawned window.

> gnome-terminal --command "echo test"

Window spawns, but there's no output.

Using Ubuntu 7.10

Revision history for this message
Jesse Aldridge (jessealdridge) wrote :

Can work around by using xterm instead:
>xterm -e "echo test; read"

Revision history for this message
Loïc Minier (lool) wrote :

I couldn't reproduce your bug; the window always closes immediately after opening with your examples.

I tried:
gnome-terminal --command "sh -c 'echo test; cat'"
which would display the text in all cases.

Revision history for this message
Jesse Aldridge (jessealdridge) wrote :

In the terminal you can go "Edit"->"Current Profile"->"Title and Command" and set "When command exits" to "Hold terminal open."

Your example works for me also, so there's another work-around.

Note that I'm still new to Linux so I may just be doing something dumb :)

Changed in gnome-terminal:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Yann Rouillard (yann-pleiades) wrote :

I confirm this bug, it's a strange one.
If I do:
    gnome-terminal --command "cat test.txt"

gnome-terminal displays nothing except if test.txt is more that 54 lines...

Anyway it's a very minor bug, why do you need this functionnality Jesse ?

Changed in gnome-terminal:
status: Incomplete → Confirmed
Revision history for this message
Jesse Aldridge (jessealdridge) wrote :

Well, I wanted to make a nautilus script (<a href="http://g-scripts.sourceforge.net/faq.php">like these</a>) so that I could right-click on any ruby file and run it through the ruby interpreter.
I ended up getting it to work via the two solutions mentioned, so it's not really a problem for me any more.

The only problem here is that because I'm new to Linux I ended up spending several frustrated hours trying to figure out what I was doing wrong, when it was a bug all along. I bet this has tripped up others as well.

Revision history for this message
Dennis Kaarsemaker (dennis) wrote :

Works for me in hardy, try with:
gnome-terminal --command 'sh -c "echo test && sleep 5"'

Revision history for this message
Jaya Ballard (jaya-ballard) wrote :

I have the "same" problem

my command:
gnome-terminal --command "echo test"

A new terminal pops up but showing only a blinking cursor, no "test" AND no prompt ....

if I start
gnome-terminal --command 'sh -c "echo test && sleep 5"'

I do see the text, but I doen't return to a prompt ...

Revision history for this message
Pedro Villavicencio (pedro) wrote :

this sounds pretty similar to bug http://bugzilla.gnome.org/show_bug.cgi?id=324407 probably because of the same cause.

Changed in gnome-terminal:
status: Confirmed → Triaged
Changed in gnome-terminal:
status: Unknown → Confirmed
Revision history for this message
Luciano Panepucci (lpanebr) wrote :

Hello,

Sorry if I sound arrogant or inconvenient in any way, it is not my intention. It just happens that I would very much like this to work and cant understand why this bug endures until now if it was reported back in 2005 (https://bugzilla.gnome.org/show_bug.cgi?id=324407#c1)..

Why can't the terminal just stay open and operational after the commands execution?

is this just because of a super low priority or is it really a hard thing to fix?

Revision history for this message
Luciano Panepucci (lpanebr) wrote :

Hi, just to let you know that I found a way to leave the prompt open and operational http://ubuntuforums.org/archive/index.php/t-296628.html

Basically you just have to create a script that initiates the command /bin/bash

then if you want to run some specific command whe that shell opens you need to create a custom .bashrcCustom and pass it with the --rcfile option like this:

#! /bin/sh

/bin/bash --rcfile .myCustombashrc

hope this helps someone

Changed in gnome-terminal:
importance: Unknown → Wishlist
Revision history for this message
MakClaudD_AR (cdmakare) wrote :

Hi! ,
sent a solution, thanks to
http://superuser.com/questions/178617/programmatically-open-tab-in-gnome-terminal-execute-command-and-have-tab-stay

gnome-terminal-e "bash-c \" echo foo; echo bar; exec bash \ ""

I encountered the same problem you
regards, El Ruso.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.