SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
try "man bash" then "/INVOCATION" (yes, use caps) - then hit "n" a couple of times to get to the right section, which describes the order of reading startup files, BASH_ENV, and lots of other stuff.
finally done. Thanks to all those who replied.
Once i got /bin/bash into my directory, i just had to use what was suggested in the earlier posts of editing .bash_profile, and having it cd to the directory and running the command.
Now for some modifications. I have the program start up in the background, however there is verbose information displayed across the screen, as the program starts up. How do i redirect that info to the bit bucket, so it is completely behind the scenes?
Also, I am running into the problem mentioned earlier, that once I am in KDE (GUI) and open a terminal, it tries to run the program again. Not a huge issue, as it just says another instance of the program is running, and ignores the command, but I would like to learn how to prevent that.
Thanks again to all of you, you have helped me learn alot.
try "man bash" then "/INVOCATION" (yes, use caps) - then hit "n" a couple of times to get to the right section, which describes the order of reading startup files, BASH_ENV, and lots of other stuff.
so where would I add the --noprofile option?? I think thats what would stop bash from running .bash_profile again, when I open a terminal??
I don't think that is the right way to go, there might be other stuff in your profile that you do want set. use something like: [HTML]
if [ ! -e /tmp/yourprogram/yourprogram.pid ] ; then
mkdir -p /tmp/yourprogramname
echo $$> /tmp/yourprogram/yourprogram.pid
#now start up the program itself
/path/to/your/program
#if the program exited normally, this will clean up the pid file
rm /tmp/yourprogram/yourprogram.pid
fi [/HTML]
Put this file somewhere in your path (~/bin usually works) and call that from your profile. Pleaseo not put this snippet directly into production, I just wrote it on the fly so you can be sure some flies and bug will be hiding in it.
Last edited by Jelle; 01-26-2006 at 11:02 AM.
Reason: fixed formatting of code
How do i redirect that info to the bit bucket, so it is completely behind the scenes?
You want to redirect the standard output and standard error (output) from the screen to /dev/null. Check the web for the Advanced Bash Scripting How-To.
Quote:
Also, I am running into the problem mentioned earlier, that once I am in KDE (GUI) and open a terminal, it tries to run the program again.
That indicates that although you placed the program in ~./bash_profile, which runs only once during the actual login, unlike .bashrc, that you are starting Konsole (or xterm, etc.) with the login shell option rather than just opening a terminal session. Consider some options to help you with that:
1. Edit ~/.bash_profile in a manner similar as suggested by Jelle so that only one instance always runs. You also might consider looking into the /sbin/pidof command, which is handy to help determine whether a program is already running. That command is kind of like a combination of ps ax | grep "whatever" and returns the pid of the program you seek.
2. Configure Konsole (or xterm, etc) with the correct options such that you normally are not running another login shell and instead run only a terminal shell. If you are using KDE, then you can place a handy icon in your Quick Launch area of the Kicker task bar. On the Kicker task bar, use your secondary mouse button to open the pop-up context menu. Then select Add to Panel, then Special Button, then Terminal Sessions. That icon will present to you several ways to start Konsole and the first option will be simply a (non-login) terminal shell, although other options will include Linux Console, root shell, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.