Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I'm trying to run a command automatically after launching an xterm window using the 'e' switch. Something like: xterm -e "ls" The problem is that this causes the xterm ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2

    Question Getting the Prompt After 'xterm -e <command>'


    Hi,

    I'm trying to run a command automatically after launching an xterm window using the 'e' switch. Something like:

    xterm -e "ls"

    The problem is that this causes the xterm window to run the command and get destroyed, that is, the command prompt is not available. But when I run the command

    xterm -e "ls && sudo su"

    the window stays open and xterm's command prompt is available for further use. But this is not what I want (I don't want to be superuser).

    My questions are:
    1. How do I get the window to stay open and also get the command prompt available (the 'hold' switch does the former, but not the latter)?
    2. If this cannot be done in xterm, is there any other terminal application which can do this?

    Thanks,

    Icarus

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by 1carus View Post
    Hi,

    I'm trying to run a command automatically after launching an xterm window using the 'e' switch. Something like:

    xterm -e "ls"

    The problem is that this causes the xterm window to run the command and get destroyed, that is, the command prompt is not available. But when I run the command

    xterm -e "ls && sudo su"

    the window stays open and xterm's command prompt is available for further use. But this is not what I want (I don't want to be superuser).

    My questions are:
    1. How do I get the window to stay open and also get the command prompt available (the 'hold' switch does the former, but not the latter)?
    2. If this cannot be done in xterm, is there any other terminal application which can do this?

    Thanks,

    Icarus
    Just launch your shell instead, for example, if you use bash:

    Code:
    xterm -e "ls; bash"

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    2

    Thumbs up

    Thanks! That worked!

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2010
    Posts
    1

    may be try this

    I did this..
    xterm -e "cd $HOME; ls; ksh"

    it works for me..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •