LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-20-2009, 09:37 PM   #1
nfirvine
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Rep: Reputation: 0
Is there anyway to execute bash as interactive and run a command?


I'm trying to start bash with a command and have it interactive like this:

bash -i -c "echo Welcome!"

As in, execute the command and allow me to use it as an interactive shell afterwards. (I'm doing something more complicated than echoing, but this doesn't work.)

I've tried this from a running gnome-terminal, from one gnome-terminal to a new one with

gnome-terminal

and from the Alt+F2 program launcher (with "Run in terminal" ticked).

Any ideas?
 
Old 06-21-2009, 12:01 AM   #2
jdkaye
Senior Member
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 4,549

Rep: Reputation: Disabled
Google is your friend.
bash startup message
result (among many others):
http://ubuntuforums.org/showthread.php?t=580470
have fun,
jdk
 
Old 06-22-2009, 03:40 AM   #3
nfirvine
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Nope, that's not what I'm looking for.

Here's the situation: Whilst programming junk, I like to have a couple of terminals open, to different directories, and one running ipython in the source directory. So I'm going to need to run a couple of different commands. I don't want to have to replace my .bashrc.
 
Old 06-22-2009, 06:36 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Maybe I don't follow you, but why not just open half a dozen gnome-terminals before you start?
 
Old 06-23-2009, 02:28 AM   #5
nfirvine
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Yeah, that's what I'm trying to do. Except I'd like to do it from a script (easy) and have each of them execute a separate command (e.g., change directory, start ipython, set some environment variables). I reckon I could switch out the .bashrc before each call, but that seems like the wrong way to do it.
 
Old 06-23-2009, 03:02 AM   #6
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,488

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
So the problem is to open a new terminal from the command line executing a command and keep it open for interactive usage, right? Take a look at a solution here. You can try to write a function that do the trick or even some aliases, each of them running a specific command.
 
Old 06-23-2009, 11:19 PM   #7
nfirvine
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
That's exactly what I wanted. The gnome-terminal -x switch is the key, and it's not in the --help. It is in the man page, however, so I suppose I should have RTFM. :P
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH - How to open an interactive script from a non interactive script..... OldGaf Programming 4 06-29-2008 04:34 PM
Execute command with spaces from variable in bash script klo_2k Linux - Newbie 4 04-13-2008 02:59 AM
Bash: execute command Ephracis Programming 9 10-07-2007 10:58 AM
[Bash] execute string as command michael_hk Linux - Newbie 2 06-26-2006 03:34 AM
Bash command $? failed to execute. Linh Programming 7 05-14-2004 11:11 AM


All times are GMT -5. The time now is 01:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration