You are not logged in.

#1 2006-12-28 02:08:45

adv
Member
Registered: 2006-12-26
Posts: 7

Bash BUG?

Hi guys,
I've a stupid problem, or it's a bash bug.
Look:

adv@osiris ~ $ su
Password: 
osiris  # mkdir try
osiris  # cd try/
osiris try # cd ..
osiris adv # 

Ok, I remove my bashrc temporany (root and user):

[adv@osiris ~]$ su
Password: 
[root@osiris ]# cd try/
[root@osiris try]# cd ..
[root@osiris adv]# 

Have you seen?
Why when i got root the directory disappears??

$ bash --version
GNU bash, version 3.2.5(1)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

Strange =
Ideas?

adv.


adv

Offline

#2 2006-12-28 08:01:47

luca
Member
From: Rome
Registered: 2005-10-30
Posts: 280

Re: Bash BUG?

Hi adv,
I think that it's not a bug; try with

su -

the "-" means login shell

Offline

#3 2006-12-28 12:15:55

ndlarsen
Member
From: Denmark
Registered: 2005-11-02
Posts: 157

Re: Bash BUG?

It seems correct to me. What you are doing is creating a dir called try, logging in as root, changing dir to try/ and stepping up one level in the directory tree. Since you are logged in as root at that time the shell displays the current dir as adv, the home dir of your regular user, rather than ~ as it is not the home dir of root. Correct me if I am wrong on this. Not sure what you mean by:

adv wrote:

Why when i got root the directory disappears??


I made it long
as I lacked the time to make it short...

Offline

#4 2006-12-28 22:38:00

adv
Member
Registered: 2006-12-26
Posts: 7

Re: Bash BUG?

luca wrote:

Hi adv,
I think that it's not a bug; try with

su -

the "-" means login shell

Yes, but in this way i'm in /root.

@ndlarsen:
If you look when i got root, directory "adv" disappears..
Now, this is how it would work correctly:

adv@osiris ~ $ su
Password:
osiris adv #

But in my computer is this:

adv@osiris ~ $ su
Password:
osiris  #

Understood? Why this?

adv.


adv

Offline

#5 2006-12-29 05:18:28

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Bash BUG?

Actually 'su -' tells su to *not* copy your environment.  i.e. start fresh.  So, yes, everything that you're seeing makes sense.  In other words, you should always 'su -' unless you have a very good reason to preserve something in the regular user environment when becoming root (a very rare case).

Offline

Board footer

Powered by FluxBB