You are not logged in.

#1 2010-02-15 16:50:03

mateusz.f
Member
Registered: 2009-04-17
Posts: 46

Bash magic help

Hi,

I'm wondering if it is possible to have some bash (or sh/zsh) command to open a new terminal and execute some other commands using it's stdin.

Example:
I want to open new konsole (or xterm or rxvt) window using a command like:

run_cmd="ls -al && read" konsole -e sh -c "$run_cmd"

However it doesn't work. It would be nice if it could take input from standard input or from run_cmd variable.

Any bash scripting hero here smile ?


/Matt

Offline

#2 2010-02-15 16:55:52

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: Bash magic help

Try run_cmd="ls -al && bash"
So just start a shell after the && as command.


Website: andrwe.org

Offline

#3 2010-02-15 17:20:19

mateusz.f
Member
Registered: 2009-04-17
Posts: 46

Re: Bash magic help

That's ok, and I know how to do it.
Still .. I want to open a new terminal with this command, as I want to be able to popup a new terminal window in ion.

Offline

#4 2010-02-15 17:37:44

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: Bash magic help

try this:

xterm -e ls\;bash &

Offline

#5 2010-02-15 17:45:35

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: Bash magic help

I'm not entirely sure what you are trying to do... but

run_cmd="ls -al && read" urxvt -e sh -c "$run_cmd"

works at least.

Last edited by Zeist (2010-02-15 17:46:56)


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

#6 2010-02-15 17:48:58

mateusz.f
Member
Registered: 2009-04-17
Posts: 46

Re: Bash magic help

I checked it and the first solution doesn't wait, it closes the terminal after ls, and the second keeps it open, but there is no output of ls, so I'm not sure if it gets called.

Combination of those two would be awesome smile

@Zeist, this comment was for you

@n0dix, wow .. thanks .. it works big_smile


now I have to find a way to place the windows where I want, but that's a different story


Again, the day was saved by Arch Community (TM)
Thank you smile

Last edited by mateusz.f (2010-02-15 17:51:49)

Offline

Board footer

Powered by FluxBB