LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 08-11-2012, 05:30 PM   #1
eldiener
Member
 
Registered: Nov 2006
Distribution: Mepis, CentOS, OpenSuse
Posts: 50

Rep: Reputation: 15
Running 'bash' question


I would like to start a console window which invokes bash and have bash execute a bash command ( 'source' ) and then remain open for further user input ( be interactive ). I imagine this must be possible. How would I do this ?

I know I can add the command to ~/.bashrc but I do not want to have the command execute each time I run a script, but only during a particular console session.
 
Old 08-11-2012, 08:52 PM   #2
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 828

Rep: Reputation: 87
Quote:
Originally Posted by eldiener View Post
I would like to start a console window which invokes bash and have bash execute a bash command ( 'source' ) and then remain open for further user input ( be interactive ). I imagine this must be possible. How would I do this ?

I know I can add the command to ~/.bashrc but I do not want to have the command execute each time I run a script, but only during a particular console session.
I can tell you how I would do this then you will probably have someone tell you a better way.
First create a special profile terminal. Do this by opening "gnome-terminal". Right click inside the terminal. Click "Profiles" then "Profile Preferences". Under the tab "General" the top line "Profile name" change it to whatever you wish to name it. Then click the tab "Title and Command". You might want to change the "Initial Title" to the Terminal Profile Name you chose before. Then down at the bottom where it says "When command exits" change that from "Exit the terminal" to "Hold the terminal open". Now make an icon with your menu editor under, say, utilities. Name it whatever you want. Click in the box on the right side "Command". Type "gnome-terminal --window-with-profile=profile_name -e some_command" where "some_command" is the name of your bash script you have written, placed somewhere in your path and done "chmod +x some_command" to make your script executable. The script will run and the terminal will remain open. Oh, and check the box "Only show in KDE" if you're using KDE. The top right box, you can click on that and choose an icon. Good luck.

Last edited by SharpyWarpy; 08-11-2012 at 09:00 PM. Reason: More info
 
Old 08-19-2012, 09:37 PM   #3
eldiener
Member
 
Registered: Nov 2006
Distribution: Mepis, CentOS, OpenSuse
Posts: 50

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by SharpyWarpy View Post
I can tell you how I would do this then you will probably have someone tell you a better way.
First create a special profile terminal. Do this by opening "gnome-terminal". Right click inside the terminal. Click "Profiles" then "Profile Preferences". Under the tab "General" the top line "Profile name" change it to whatever you wish to name it. Then click the tab "Title and Command". You might want to change the "Initial Title" to the Terminal Profile Name you chose before. Then down at the bottom where it says "When command exits" change that from "Exit the terminal" to "Hold the terminal open". Now make an icon with your menu editor under, say, utilities. Name it whatever you want. Click in the box on the right side "Command". Type "gnome-terminal --window-with-profile=profile_name -e some_command" where "some_command" is the name of your bash script you have written, placed somewhere in your path and done "chmod +x some_command" to make your script executable. The script will run and the terminal will remain open. Oh, and check the box "Only show in KDE" if you're using KDE. The top right box, you can click on that and choose an icon. Good luck.
I am using Konsole under KDE and unfortunately there is no "Hold the terminal open" for Konsole profiles that I can see.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash running time cristalp Programming 5 09-19-2011 01:22 PM
Running bash but common bash commands not working michellepace Linux - Newbie 11 07-17-2010 09:19 AM
[SOLVED] A question about running bash scripts in KDE em21701 Slackware 7 12-11-2009 04:53 PM
running su from a bash script caminoix Programming 7 12-28-2005 03:41 PM
bash - running before I can walk! Alan Lakin Programming 8 03-11-2004 10:14 AM


All times are GMT -5. The time now is 07:11 PM.

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
Open Source Consulting | Domain Registration