Linux - GeneralThis 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
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.
I'm newbie in linux, doesn't quite understand many things linux, I'm just starting migrating from windows to linux.
I'm trying to create a .bash_login file and put :
/home/user/client.py
but that doesn't working, trying to put :
python
import client
client.init()
stil doesn't working, remove the "python" line also not working (each trying logoff and login).
If I didn't misunderstand, by using .bash_login do you mean that I should use Bash Script ?
After I'm reading the web, there is special start up bash file for init the system but the name is .bash_profile not .bash_login
I'm even tried to put /home/user/client.py in .bash_profile but nothing happen.
Anyway could you please help me out by step by step on how to do it, because I'm really confuse.
The first line identifies it as a bash script, and then it calls python and tells it to read the python script. It probably also needs to be marked executable:
PHP Code:
~> chmod +x .bash_login
Sorry no one was able to help you with this before.
You could also put the script invocation line in the python script like:
Code:
#! /usr/bin/python
import client
client.init()
Then set the script as executable:
Code:
chmod +x /home/user/client.py
Then you can reference it from your .bash_login, .bash_profile or .bashrc
Code:
/home/user/client.py
I don't normally use .bash_login but .bash_profile is only run for at login and .bashrc is run for every shell.
If you need your script run for all users, you can put your script in /etc/bash.bashrc, but I would read some of the comments in this file to see if it is right for your purpose.
If you are looking to have this script run at system startup. I would put the script in /usr/local/bin and then I would link to it in one of the /etc/rc#.d directories, probably /etc/rc3.d.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.