You are not logged in.

#1 2014-02-06 15:25:07

replax
Member
Registered: 2011-02-12
Posts: 90

[SOLVED] how to execute a command on xterm start

hi guys,

i want to execute a command each time i start xterm in that terminal itself.
i know about bashrc, but what I want to do is make it exclusively launch when xterm is started. when i want to use other terminals, e.g. terminology etc. i do not want that command to be executed.

has anybody an idea if that is possible (or possible with a different term)?

thanks!

Last edited by replax (2014-02-07 19:40:57)

Offline

#2 2014-02-06 15:52:20

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] how to execute a command on xterm start

You can either run xterm using the execute switch...

xterm -e command

Or add the command to your ~/.bashrc with a test to check that the current terminal is xterm, something like...

if [ $TERM = xterm ]; then
  command
fi

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2014-02-06 16:52:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] how to execute a command on xterm start

What command is it exactly?

Offline

#4 2014-02-06 18:04:32

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] how to execute a command on xterm start

slithery wrote:

You can either run xterm using the execute switch...

xterm -e command

This will only work if the "command" doesn't exit after executing, otherwise xterm will vanish in an instant. So use this to run programs, such as weechat, irrsi, etc.

Or add the command to your ~/.bashrc with a test to check that the current terminal is xterm, something like...

if [ $TERM = xterm ]; then
  command
fi

This one is better suited for a command that behaves as mentioned above.

Offline

#5 2014-02-07 19:20:31

replax
Member
Registered: 2011-02-12
Posts: 90

Re: [SOLVED] how to execute a command on xterm start

Thanks for your suggestions!
@slithery, your second suggestions works well, except for one ceveat i am not sure of.
upon term opening i want to launch "t ls" for listing my todo's

however, e.g. Terminology's $TERM is also xterm

 echo $TERM
xterm 

is that an issue of terminology?

EDIT:
solved it by:
running "env" and checking for vars unique to terminology/xterm, one of them was $TERMINOLOGY=1
checking for that solved my problem, thanks for all the input smile!!

Last edited by replax (2014-02-07 19:40:45)

Offline

Board footer

Powered by FluxBB