/root or $HOME? [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

/root or $HOME? [SOLVED]

#1 Post by Argolance »

Hello,
/root or $HOME?
Inside a script, are these to paths equivalent or different, for example, has this any importance according to the mode Puppy is running?
Thank you for your attention.

Cordialement.
Last edited by Argolance on Tue 02 Apr 2013, 18:27, edited 1 time in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: /root or $HOME?

#2 Post by L18L »

Argolance wrote:equivalent or different
equivalent if running as root

different if not running as root (---> fido, spot, rex or any other name)
fido's HOME is /root/fido
spot's HOME is /root/spot

I would recommend always $HOME

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Salut Argolance.

In addition to L18L's observations, if, in a console, you type :
  • Code: Select all

    rox /mnt/home
    you get the directory where your Puppy system files are located;

    Code: Select all

    rox $HOME
    you get the usual "/root";

    Code: Select all

    rox $home
    you get a listing of the directory from which you issued your command.
I hope this helps.

Bye for now.

musher0
Last edited by musher0 on Tue 02 Apr 2013, 19:07, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#4 Post by darkcity »

Can't you use
~/
to point the current 'root/home' directory.

Which means it will work on a Linux that is using non-root login. So maybe ~/ = $HOME ?

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

'~/' and '$HOME' are equivalent and should always be used instead of any hard-coded path to the users home dir.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#6 Post by Argolance »

Hello,
Thank you to all of you, "mates"! :wink:

Cordialement.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

Am launching xwin via /etc/inittab :

Code: Select all

bash-3.2# echo $HOME
/
It appears that rox uses "$HOME" as well.

Some probably should be /root though :

/root/.packages
/root/.pup_event

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#8 Post by amigo »

At the time that inittab is used, *no* user is logged in. Everything is run effectively as root during init, but root is not logged in. It's called Single User Mode. That's why $HOME evaluates to '/' -the default.

Post Reply