Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.bash_profile modification

147 views
Skip to first unread message

ritchie31

unread,
Sep 8, 2012, 6:51:09 PM9/8/12
to
Hello Forum.
I modified my .bash_profile by adding a welcome message and showing me the data time as I saw in an example.


# .bash_profile


# This only runs on user login
echo ""
echo -n "Welcome to Linux, "; whoami
echo ""
echo -n "Today is "; date "+%m-%d-%Y %H:%M:%S"
echo ""
cal

# This loads in the configuration in .bashrc
# Put all configuration there!


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH


However every time I start the terminal It does not show me the messages I configured on it.
Is it anything wrong on it?. I changed the attributes to chmod 777 .bash_profile

Thanks

Bit Twister

unread,
Sep 8, 2012, 7:06:04 PM9/8/12
to
On Sat, 8 Sep 2012 15:51:09 -0700 (PDT), ritchie31 wrote:
> Hello Forum.
> I modified my .bash_profile by adding a welcome message and showing me the data time as I saw in an example.
>
>
> # .bash_profile
>
>

If it were me I would at least move your echo, cal code after the
export PATH statement.

>
> However every time I start the terminal It does not show me the messages I configured on it.

Hmmm, guessing you have logged in and your desktop manager is running,
and you clicked up a terminal and wonder why it did not work.
Yup, situation normal.


> Is it anything wrong on it?.

With the lack of information provided and my above assumption, it is
working as designed.


> I changed the attributes to chmod 777 .bash_profile

Why let the others and group users modify the file? :(
Put it back like your found it:
chmod 644 .bash_profile

When you click up a terminal, .bash_profile does not run, .bashrc will
run.

Anytime you want to debug something like the above, put a
set -x
above where you want to start seeing something happening.
To turn it back off, do a
set -

Now if the system runlevel is not gui login, then I would have
expected it to run your code just after entering your password.

Icarus Sparry

unread,
Sep 9, 2012, 2:10:29 PM9/9/12
to
The most likely reason is that your "terminal" is not announcing that it
is a "login" window.

If you read the manual for bash, you will see it reads different files
depending on how it is invoked.

Try running
xterm -ls
or
gnome-terminal -e bash --login

If you are using gnome-terminal, then you can change the preferences
associated with a profile to say it should be considered a login window.
xterm -ls

Icarus Sparry

unread,
Sep 9, 2012, 6:44:57 PM9/9/12
to
On Sat, 08 Sep 2012 15:51:09 -0700, ritchie31 wrote:

ritchie31

unread,
Sep 12, 2012, 8:35:54 PM9/12/12
to
Thanks everyone for your inputs. I put my piece of code into my .bashrc file and now is working fine.
I read something from the terminal in Mac and they use the piece of code in .bash_profile to show the message.

Best of regards
0 new messages