.login file
My terminal want to display username, time and date whenever logged into the terminal.
For that i made a script which displays username and date My script is as follows Code:
who am i | cut -d " " -f1 I want to run this script whenevr i log in So i want to put 'userdate' into .login file But how can i do that Where can i find .login file |
look in your home directory.
|
Quote:
run ls -la in you r home dir , it may be there. if not there create a file on that name and and put the script in that file, make it executable and make an entry in profile/rc file in your home dir to execute .login. |
In case you are using bash ...
Bash does not use a .login file. It uses the first (if any) of ~/.bash_profile, ~/.bash_login and ~/.profile |
I got login file inside bin
i copied my file into login but then also when i am logging in i didnt get the desired output |
Changing files in /bin (or /usr/bin, /sbin and /usr/sbin) can break your system. Even if it works, such can be lost on routine system upgrade.
It is not necessary to change /bin/login to achieve what you want. Earlier replies in this thread have suggested appropriate ways. |
make an entry in profile/rc file in your home dir to execute .login.
HOW ITS POSSIBLE? |
What shell are you running (sh, bash, tcsh, etc.)?
|
Quote:
Run this to get: Quote:
If ksh the the files are : ~/.profile and ~/.kshrc or ~/.login file may be there. if csh the files are : ~/.cshrc You can add an entry like this: Code:
. ~/.login where .login contains the script you want to excute. When you login the these rc/profile file executes whatever written in them. |
All times are GMT -5. The time now is 04:57 AM. |